Windows: Remove Driver Verifier warning of memory leak
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 21 Mar 2013 10:28:25 +0000 (06:28 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 22 Mar 2013 14:31:08 +0000 (07:31 -0700)
Work items are now queued in an AFSRedir.sys data structure
and are not freed when AFSRedirLib.sys is unloaded.  Therefore,
do allocate the memory with AFSLibExAllocatePoolWithTag().
The allocation by AFSLibExAllocatePoolWithTag results in a false
Driver Verifier warning of a memory leak on unload.

Change-Id: I268c4b6d20090e88114456a24b7648eef59f6289
Reviewed-on: http://gerrit.openafs.org/9641
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

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

index 3841776..478f987 100644 (file)
@@ -2370,9 +2370,9 @@ AFSQueueFlushExtents( IN AFSFcb *Fcb,
         // Allocate our request structure and send it to the worker
         //
 
-        pWorkItem = (AFSWorkItem *)AFSLibExAllocatePoolWithTag( NonPagedPool,
-                                                                sizeof( AFSWorkItem),
-                                                                AFS_WORK_ITEM_TAG);
+        pWorkItem = (AFSWorkItem *)AFSExAllocatePoolWithTag( NonPagedPool,
+                                                             sizeof( AFSWorkItem),
+                                                             AFS_WORK_ITEM_TAG);
 
         if( pWorkItem == NULL)
         {
@@ -2499,9 +2499,9 @@ AFSQueueGlobalRootEnumeration()
     __try
     {
 
-        pWorkItem = (AFSWorkItem *) AFSLibExAllocatePoolWithTag( NonPagedPool,
-                                                                 sizeof(AFSWorkItem),
-                                                                 AFS_WORK_ITEM_TAG);
+        pWorkItem = (AFSWorkItem *) AFSExAllocatePoolWithTag( NonPagedPool,
+                                                              sizeof(AFSWorkItem),
+                                                              AFS_WORK_ITEM_TAG);
         if (NULL == pWorkItem)
         {
 
@@ -2591,9 +2591,9 @@ AFSQueueStartIos( IN PFILE_OBJECT CacheFileObject,
         // Allocate our request structure and send it to the worker
         //
 
-        pWorkItem = (AFSWorkItem *)AFSLibExAllocatePoolWithTag( NonPagedPool,
-                                                                sizeof( AFSWorkItem),
-                                                                AFS_WORK_ITEM_TAG);
+        pWorkItem = (AFSWorkItem *)AFSExAllocatePoolWithTag( NonPagedPool,
+                                                             sizeof( AFSWorkItem),
+                                                             AFS_WORK_ITEM_TAG);
 
         if( pWorkItem == NULL)
         {
@@ -2678,9 +2678,9 @@ AFSQueueInvalidateObject( IN AFSObjectInfoCB *ObjectInfo,
     __try
     {
 
-        pWorkItem = (AFSWorkItem *) AFSLibExAllocatePoolWithTag( NonPagedPool,
-                                                                 sizeof(AFSWorkItem),
-                                                                 AFS_WORK_ITEM_TAG);
+        pWorkItem = (AFSWorkItem *) AFSExAllocatePoolWithTag( NonPagedPool,
+                                                              sizeof(AFSWorkItem),
+                                                              AFS_WORK_ITEM_TAG);
         if (NULL == pWorkItem)
         {
 
@@ -2773,9 +2773,9 @@ AFSDeferWrite( IN PDEVICE_OBJECT DeviceObject,
             try_return( ntStatus = STATUS_INSUFFICIENT_RESOURCES );
         }
 
-        pWorkItem = (AFSWorkItem *) AFSLibExAllocatePoolWithTag( NonPagedPool,
-                                                                 sizeof(AFSWorkItem),
-                                                                 AFS_WORK_ITEM_TAG);
+        pWorkItem = (AFSWorkItem *) AFSExAllocatePoolWithTag( NonPagedPool,
+                                                              sizeof(AFSWorkItem),
+                                                              AFS_WORK_ITEM_TAG);
 
         if (NULL == pWorkItem)
         {