Windows: close leak in AFSPrimaryVolumeWorkerThread
authorJeffrey Altman <jaltman@your-file-system.com>
Tue, 25 Oct 2011 17:30:19 +0000 (13:30 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 25 Oct 2011 17:48:22 +0000 (10:48 -0700)
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 <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp

index a2b4022..426626a 100644 (file)
@@ -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,