From 782fba58db1210e998ef9c6a50803262ac256812 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 25 Oct 2011 13:30:19 -0400 Subject: [PATCH] Windows: close leak in AFSPrimaryVolumeWorkerThread Prevent a leak of the non-paged pool and a Resource by freeing all allocations within the Specific.Directory.PIOCtlDirectoryCB object. Use AFSExFreePool() instead of ExFreePool() because the objects are allocated from the AFSRedir.sys driver allocator. FIXES 130280 Change-Id: I3b1c8fa838cfdf434bf7c08bb8935999cf328357 Reviewed-on: http://gerrit.openafs.org/5730 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp b/src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp index a2b4022de..426626a4f 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp @@ -1114,7 +1114,11 @@ AFSPrimaryVolumeWorkerThread( IN PVOID Context) AFSDeleteObjectInfo( pCurrentObject->Specific.Directory.PIOCtlDirectoryCB->ObjectInformation); - ExFreePool( pCurrentObject->Specific.Directory.PIOCtlDirectoryCB); + ExDeleteResourceLite( &pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB->NonPaged->Lock); + + AFSExFreePool( pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB->NonPaged); + + AFSExFreePool( pCurrentObject->Specific.Directory.PIOCtlDirectoryCB); } AFSDbgLogMsg( AFS_SUBSYSTEM_CLEANUP_PROCESSING, @@ -1311,9 +1315,9 @@ AFSPrimaryVolumeWorkerThread( IN PVOID Context) ExDeleteResourceLite( &pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB->NonPaged->Lock); - ExFreePool( pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB->NonPaged); + AFSExFreePool( pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB->NonPaged); - ExFreePool( pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB); + AFSExFreePool( pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB); } AFSDbgLogMsg( AFS_SUBSYSTEM_CLEANUP_PROCESSING, -- 2.39.5