Windows: AFSExFreePool -> AFSExFreePoolWithTag
authorJeffrey Altman <jaltman@your-file-system.com>
Sat, 21 Jul 2012 15:52:22 +0000 (11:52 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Sun, 22 Jul 2012 03:19:15 +0000 (20:19 -0700)
Replace AFSExFreePool() with AFSExFreePoolWithTag() which is
a wrapper around both ExFreePool() and ExFreePoolWithTag().
If a 'Tag' value, is provided, ExFreePoolWithTag() is used.
Otherwise, ExFreePool().

Specify allocation tag values wherever possible.  Path name buffer
tags are not specified because they are allocated using multiple
tags.  The same is true for network provider string buffers.

This is being done in order to debug a memory corruption issue.

Warning: this is a change to the AFSRedir->AFSRedirLib interface
and therefore both drivers must be updated with a reboot and
not simply restarting the service.

Change-Id: Id5c0503141d1077d6c2beae5d28602160105a312
Reviewed-on: http://gerrit.openafs.org/7807
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

20 files changed:
src/WINNT/afsrdr/common/AFSRedirCommonStructs.h
src/WINNT/afsrdr/kernel/fs/AFSGeneric.cpp
src/WINNT/afsrdr/kernel/fs/AFSLibrarySupport.cpp
src/WINNT/afsrdr/kernel/fs/AFSRDRSupport.cpp
src/WINNT/afsrdr/kernel/fs/Include/AFSCommon.h
src/WINNT/afsrdr/kernel/lib/AFSCleanup.cpp
src/WINNT/afsrdr/kernel/lib/AFSCommSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp
src/WINNT/afsrdr/kernel/lib/AFSData.cpp
src/WINNT/afsrdr/kernel/lib/AFSDirControl.cpp
src/WINNT/afsrdr/kernel/lib/AFSExtentsSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSFcbSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSGeneric.cpp
src/WINNT/afsrdr/kernel/lib/AFSIoSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSNetworkProviderSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSRead.cpp
src/WINNT/afsrdr/kernel/lib/AFSWorker.cpp
src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp
src/WINNT/afsrdr/kernel/lib/Include/AFSExtern.h

index 8f334d5..217ecc7 100644 (file)
@@ -775,7 +775,7 @@ void *
 
 typedef
 void
-(*PAFSExFreePool)( IN void *Pointer);
+(*PAFSExFreePoolWithTag)( IN void *Pointer, IN ULONG Tag);
 
 typedef
 void
@@ -814,7 +814,7 @@ typedef struct _AFS_LIBRARY_INIT_CB
 
     PAFSExAllocatePoolWithTag   AFSExAllocatePoolWithTag;
 
-    PAFSExFreePool      AFSExFreePool;
+    PAFSExFreePoolWithTag      AFSExFreePoolWithTag;
 
     PAFSDumpTraceFiles  AFSDumpTraceFiles;
 
index 7679302..0ec1ed6 100644 (file)
@@ -1404,7 +1404,7 @@ AFSExAllocatePoolWithTag( IN POOL_TYPE  PoolType,
 }
 
 void
-AFSExFreePool( IN void *Buffer)
+AFSExFreePoolWithTag( IN void *Buffer, IN ULONG Tag)
 {
 
     AFSDeviceExt *pControlDevExt = NULL;
@@ -1415,7 +1415,16 @@ AFSExFreePool( IN void *Buffer)
         pControlDevExt = (AFSDeviceExt *)AFSDeviceObject->DeviceExtension;
     }
 
-    ExFreePool( Buffer);
+    if ( Tag)
+    {
+
+        ExFreePoolWithTag( Buffer, Tag);
+    }
+    else
+    {
+
+        ExFreePool( Buffer);
+    }
 
     if ( pControlDevExt)
     {
index 98ac0d4..bed174d 100644 (file)
@@ -895,7 +895,7 @@ AFSInitializeLibrary( IN AFSFileID *GlobalRootFid,
 
         stInitLib.AFSExAllocatePoolWithTag = AFSExAllocatePoolWithTag;
 
-        stInitLib.AFSExFreePool = AFSExFreePool;
+        stInitLib.AFSExFreePoolWithTag = AFSExFreePoolWithTag;
 
         stInitLib.AFSDumpTraceFiles = AFSDumpTraceFiles;
 
index 45ad910..4b28bb9 100644 (file)
@@ -976,14 +976,14 @@ AFSRemoveRdrFcb( IN OUT AFSFcb **RdrFcb)
         // The non paged region
         //
 
-        AFSExFreePool( pFcb->NPFcb);
+        AFSExFreePoolWithTag( pFcb->NPFcb, AFS_FCB_NP_ALLOCATION_TAG);
     }
 
     //
     // And the Fcb itself
     //
 
-    AFSExFreePool( pFcb);
+    AFSExFreePoolWithTag( pFcb, AFS_FCB_ALLOCATION_TAG);
 
     return;
 }
index 5ae8604..e2b4643 100644 (file)
@@ -478,7 +478,7 @@ AFSExAllocatePoolWithTag( IN POOL_TYPE  PoolType,
                           IN ULONG  Tag);
 
 void
-AFSExFreePool( IN void *Buffer);
+AFSExFreePoolWithTag( IN void *Buffer, IN ULONG Tag);
 
 NTSTATUS
 AFSShutdownRedirector( void);
index 8c2eaf6..038fe55 100644 (file)
@@ -1361,7 +1361,7 @@ try_exit:
         if( pResultCB != NULL)
         {
 
-            AFSExFreePool( pResultCB);
+            AFSExFreePoolWithTag( pResultCB, AFS_GENERIC_MEMORY_32_TAG);
         }
 
         if( pFileObject != NULL)
index 3838185..5bf6053 100644 (file)
@@ -660,7 +660,7 @@ try_exit:
         if( pBuffer != NULL)
         {
 
-            AFSExFreePool( pBuffer);
+            AFSExFreePoolWithTag( pBuffer, AFS_DIR_BUFFER_TAG);
         }
 
         //
@@ -1491,7 +1491,7 @@ try_exit:
         if( pBuffer != NULL)
         {
 
-            AFSExFreePool( pBuffer);
+            AFSExFreePoolWithTag( pBuffer, AFS_DIR_BUFFER_TAG);
         }
     }
 
@@ -1822,7 +1822,7 @@ try_exit:
         if( pResultCB != NULL)
         {
 
-            AFSExFreePool( pResultCB);
+            AFSExFreePoolWithTag( pResultCB, AFS_GENERIC_MEMORY_1_TAG);
         }
     }
 
@@ -1924,7 +1924,7 @@ try_exit:
         if( pUpdateResultCB != NULL)
         {
 
-            AFSExFreePool( pUpdateResultCB);
+            AFSExFreePoolWithTag( pUpdateResultCB, AFS_UPDATE_RESULT_TAG);
         }
     }
 
@@ -2232,7 +2232,7 @@ try_exit:
         if( pRenameCB != NULL)
         {
 
-            AFSExFreePool( pRenameCB);
+            AFSExFreePoolWithTag( pRenameCB, AFS_RENAME_REQUEST_TAG);
         }
     }
 
@@ -2381,7 +2381,7 @@ try_exit:
         if( pEvalResultCB != NULL)
         {
 
-            AFSExFreePool( pEvalResultCB);
+            AFSExFreePoolWithTag( pEvalResultCB, AFS_GENERIC_MEMORY_30_TAG);
         }
 
         if( !NT_SUCCESS( ntStatus))
@@ -2390,7 +2390,7 @@ try_exit:
             if( pDirEnumCB != NULL)
             {
 
-                AFSExFreePool( pDirEnumCB);
+                AFSExFreePoolWithTag( pDirEnumCB, AFS_GENERIC_MEMORY_2_TAG);
             }
 
             *DirEnumEntry = NULL;
@@ -2512,7 +2512,7 @@ try_exit:
         if( pEvalResultCB != NULL)
         {
 
-            AFSExFreePool( pEvalResultCB);
+            AFSExFreePoolWithTag( pEvalResultCB, AFS_GENERIC_MEMORY_31_TAG);
         }
 
         if( !NT_SUCCESS( ntStatus))
@@ -2521,7 +2521,7 @@ try_exit:
             if( pDirEnumCB != NULL)
             {
 
-                AFSExFreePool( pDirEnumCB);
+                AFSExFreePoolWithTag( pDirEnumCB, AFS_GENERIC_MEMORY_3_TAG);
             }
 
             *DirEnumEntry = NULL;
@@ -2730,7 +2730,7 @@ try_exit:
         if( pIoRequest != NULL)
         {
 
-            AFSExFreePool( pIoRequest);
+            AFSExFreePoolWithTag( pIoRequest, AFS_GENERIC_MEMORY_4_TAG);
         }
     }
 
@@ -2807,7 +2807,7 @@ try_exit:
         if( pInfoRequest != NULL)
         {
 
-            AFSExFreePool( pInfoRequest);
+            AFSExFreePoolWithTag( pInfoRequest, AFS_GENERIC_MEMORY_5_TAG);
         }
     }
 
index df0555e..cfaae80 100644 (file)
@@ -1250,7 +1250,7 @@ try_exit:
             if( uniSubstitutedPathName.Buffer != NULL)
             {
 
-                AFSExFreePool( uniSubstitutedPathName.Buffer);
+                AFSExFreePoolWithTag( uniSubstitutedPathName.Buffer, 0);
 
                 ClearFlag( ulParseFlags, AFS_PARSE_FLAG_FREE_FILE_BUFFER);
             }
@@ -1269,7 +1269,7 @@ try_exit:
         if( BooleanFlagOn( ulParseFlags, AFS_PARSE_FLAG_FREE_FILE_BUFFER))
         {
 
-            AFSExFreePool( uniRootFileName.Buffer);
+            AFSExFreePoolWithTag( uniRootFileName.Buffer, 0);
         }
 
         if( bReleaseVolume)
index 7483916..7f69fa1 100644 (file)
@@ -98,7 +98,7 @@ PAFSAddConnectionEx AFSAddConnectionEx = NULL;
 
 PAFSExAllocatePoolWithTag   AFSExAllocatePoolWithTag = NULL;
 
-PAFSExFreePool      AFSExFreePool = NULL;
+PAFSExFreePoolWithTag      AFSExFreePoolWithTag = NULL;
 
 PAFSDumpTraceFiles  AFSDumpTraceFilesFnc = AFSDumpTraceFiles_Default;
 
index e67de20..c32caf9 100644 (file)
@@ -1446,7 +1446,7 @@ AFSSnapshotDirectory( IN AFSFcb *Fcb,
             if( Ccb->DirectorySnapshot != NULL)
             {
 
-                AFSExFreePool( Ccb->DirectorySnapshot);
+                AFSExFreePoolWithTag( Ccb->DirectorySnapshot, AFS_DIR_SNAPSHOT_TAG);
 
                 Ccb->DirectorySnapshot = NULL;
             }
@@ -1534,7 +1534,7 @@ AFSSnapshotDirectory( IN AFSFcb *Fcb,
         if( Ccb->DirectorySnapshot != NULL)
         {
 
-            AFSExFreePool( Ccb->DirectorySnapshot);
+            AFSExFreePoolWithTag( Ccb->DirectorySnapshot, AFS_DIR_SNAPSHOT_TAG);
 
             Ccb->DirectorySnapshot = NULL;
         }
@@ -1642,7 +1642,7 @@ try_exit:
             if( Ccb->NotifyMask.Buffer != NULL)
             {
 
-                AFSExFreePool( Ccb->NotifyMask.Buffer);
+                AFSExFreePoolWithTag( Ccb->NotifyMask.Buffer, AFS_GENERIC_MEMORY_7_TAG);
 
                 Ccb->NotifyMask.Buffer = NULL;
             }
@@ -1763,7 +1763,7 @@ try_exit:
         if( uniName.Buffer != NULL)
         {
 
-            AFSExFreePool( uniName.Buffer);
+            AFSExFreePoolWithTag( uniName.Buffer, AFS_GENERIC_MEMORY_8_TAG);
         }
     }
 
index 1c23736..16621da 100644 (file)
@@ -129,7 +129,7 @@ AFSFreeExtent( IN AFSFcb *Fcb,
                     FALSE);
     }
 
-    AFSExFreePool( pExtent);
+    AFSExFreePoolWithTag( pExtent, AFS_EXTENT_TAG);
 }
 
 //
@@ -391,7 +391,7 @@ try_exit:
         if (pRelease)
         {
 
-            AFSExFreePool( pRelease);
+            AFSExFreePoolWithTag( pRelease, AFS_EXTENT_RELEASE_TAG);
         }
     }
 }
@@ -2427,7 +2427,7 @@ try_exit:
             Irp->AssociatedIrp.SystemBuffer != pResult)
         {
 
-            AFSExFreePool(pResult);
+            AFSExFreePoolWithTag(pResult, AFS_EXTENTS_RESULT_TAG);
         }
 
         if (NT_SUCCESS(ntStatus))
@@ -2832,7 +2832,7 @@ try_exit:
 
         if (pRelease)
         {
-            AFSExFreePool( pRelease);
+            AFSExFreePoolWithTag( pRelease, AFS_EXTENT_RELEASE_TAG);
         }
     }
 
@@ -3098,7 +3098,7 @@ try_exit:
 
         if (pRelease)
         {
-            AFSExFreePool( pRelease);
+            AFSExFreePoolWithTag( pRelease, AFS_EXTENT_RELEASE_TAG);
         }
     }
 
@@ -3331,7 +3331,7 @@ try_exit:
 
         if (pRelease)
         {
-            AFSExFreePool( pRelease);
+            AFSExFreePoolWithTag( pRelease, AFS_EXTENT_RELEASE_TAG);
         }
     }
 
@@ -4255,7 +4255,7 @@ AFSSetupMD5Hash( IN AFSFcb *Fcb,
         if( pExtentBuffer != NULL)
         {
 
-            AFSExFreePool( pExtentBuffer);
+            AFSExFreePoolWithTag( pExtentBuffer, AFS_GENERIC_MEMORY_9_TAG);
         }
     }
 
index e9add10..53da2ce 100644 (file)
@@ -334,10 +334,10 @@ try_exit:
 
                     ExDeleteResourceLite( &pNPFcb->Resource);
 
-                    AFSExFreePool( pNPFcb);
+                    AFSExFreePoolWithTag( pNPFcb, AFS_FCB_NP_ALLOCATION_TAG);
                 }
 
-                AFSExFreePool( pFcb);
+                AFSExFreePoolWithTag( pFcb, AFS_FCB_ALLOCATION_TAG);
             }
         }
     }
@@ -470,7 +470,7 @@ AFSInitVolume( IN GUID *AuthGroup,
 
         pNonPagedVcb = (AFSNonPagedVolumeCB *)AFSExAllocatePoolWithTag( NonPagedPool,
                                                                         sizeof( AFSNonPagedVolumeCB),
-                                                                        AFS_VCB_ALLOCATION_TAG);
+                                                                        AFS_VCB_NP_ALLOCATION_TAG);
 
         if( pNonPagedVcb == NULL)
         {
@@ -491,7 +491,7 @@ AFSInitVolume( IN GUID *AuthGroup,
 
         pNonPagedObject = (AFSNonPagedObjectInfoCB *)AFSExAllocatePoolWithTag( NonPagedPool,
                                                                                sizeof( AFSNonPagedObjectInfoCB),
-                                                                               AFS_VCB_ALLOCATION_TAG);
+                                                                               AFS_NP_OBJECT_INFO_TAG);
 
         if( pNonPagedObject == NULL)
         {
@@ -667,7 +667,7 @@ try_exit:
 
                 ExDeleteResourceLite( &pNonPagedVcb->ObjectInfoTreeLock);
 
-                AFSExFreePool( pNonPagedVcb);
+                AFSExFreePoolWithTag( pNonPagedVcb, AFS_VCB_NP_ALLOCATION_TAG);
             }
 
             if( pNonPagedObject != NULL)
@@ -675,7 +675,7 @@ try_exit:
 
                 ExDeleteResourceLite( &pNonPagedObject->DirectoryNodeHdrLock);
 
-                AFSExFreePool( pNonPagedObject);
+                AFSExFreePoolWithTag( pNonPagedObject, AFS_NP_OBJECT_INFO_TAG);
             }
 
             if( pVolumeCB != NULL)
@@ -684,10 +684,10 @@ try_exit:
                 if( pVolumeCB->DirectoryCB != NULL)
                 {
 
-                    AFSExFreePool( pVolumeCB->DirectoryCB);
+                    AFSExFreePoolWithTag( pVolumeCB->DirectoryCB, AFS_DIR_ENTRY_TAG);
                 }
 
-                AFSExFreePool( pVolumeCB);
+                AFSExFreePoolWithTag( pVolumeCB, AFS_VCB_ALLOCATION_TAG);
             }
 
             if( pNonPagedDirEntry != NULL)
@@ -695,7 +695,7 @@ try_exit:
 
                 ExDeleteResourceLite( &pNonPagedDirEntry->Lock);
 
-                AFSExFreePool( pNonPagedDirEntry);
+                AFSExFreePoolWithTag( pNonPagedDirEntry, AFS_DIR_ENTRY_NP_TAG);
             }
         }
 
@@ -786,7 +786,7 @@ AFSRemoveVolume( IN AFSVolumeCB *VolumeCB)
 
             AFSDeleteObjectInfo( VolumeCB->ObjectInformation.Specific.Directory.PIOCtlDirectoryCB->ObjectInformation);
 
-            AFSExFreePool( VolumeCB->ObjectInformation.Specific.Directory.PIOCtlDirectoryCB);
+            AFSExFreePoolWithTag( VolumeCB->ObjectInformation.Specific.Directory.PIOCtlDirectoryCB, AFS_DIR_ENTRY_TAG);
         }
 
         if( BooleanFlagOn( VolumeCB->ObjectInformation.Flags, AFS_OBJECT_HELD_IN_SERVICE))
@@ -815,7 +815,7 @@ AFSRemoveVolume( IN AFSVolumeCB *VolumeCB)
 
             ExDeleteResourceLite( &VolumeCB->NonPagedVcb->ObjectInfoTreeLock);
 
-            AFSExFreePool( VolumeCB->NonPagedVcb);
+            AFSExFreePoolWithTag( VolumeCB->NonPagedVcb, AFS_VCB_NP_ALLOCATION_TAG);
         }
 
         if( VolumeCB->ObjectInformation.NonPagedInfo != NULL)
@@ -823,7 +823,7 @@ AFSRemoveVolume( IN AFSVolumeCB *VolumeCB)
 
             ExDeleteResourceLite( &VolumeCB->ObjectInformation.NonPagedInfo->DirectoryNodeHdrLock);
 
-            AFSExFreePool( VolumeCB->ObjectInformation.NonPagedInfo);
+            AFSExFreePoolWithTag( VolumeCB->ObjectInformation.NonPagedInfo, AFS_NP_OBJECT_INFO_TAG);
         }
 
         if( VolumeCB->DirectoryCB != NULL)
@@ -834,13 +834,13 @@ AFSRemoveVolume( IN AFSVolumeCB *VolumeCB)
 
                 ExDeleteResourceLite( &VolumeCB->DirectoryCB->NonPaged->Lock);
 
-                AFSExFreePool( VolumeCB->DirectoryCB->NonPaged);
+                AFSExFreePoolWithTag( VolumeCB->DirectoryCB->NonPaged, AFS_DIR_ENTRY_NP_TAG);
             }
 
-            AFSExFreePool( VolumeCB->DirectoryCB);
+            AFSExFreePoolWithTag( VolumeCB->DirectoryCB, AFS_DIR_ENTRY_TAG);
         }
 
-        AFSExFreePool( VolumeCB);
+        AFSExFreePoolWithTag( VolumeCB, AFS_VCB_ALLOCATION_TAG);
     }
 
     return ntStatus;
@@ -1010,14 +1010,14 @@ AFSRemoveRootFcb( IN AFSFcb *RootFcb)
         // The non paged region
         //
 
-        AFSExFreePool( RootFcb->NPFcb);
+        AFSExFreePoolWithTag( RootFcb->NPFcb, AFS_FCB_NP_ALLOCATION_TAG);
     }
 
     //
     // And the Fcb itself
     //
 
-    AFSExFreePool( RootFcb);
+    AFSExFreePoolWithTag( RootFcb, AFS_FCB_ALLOCATION_TAG);
 
     return;
 }
@@ -1097,13 +1097,13 @@ AFSRemoveFcb( IN AFSFcb **ppFcb)
     // The non paged region
     //
 
-    AFSExFreePool( pFcb->NPFcb);
+    AFSExFreePoolWithTag( pFcb->NPFcb, AFS_FCB_NP_ALLOCATION_TAG);
 
     //
     // And the Fcb itself, which includes the name
     //
 
-    AFSExFreePool( pFcb);
+    AFSExFreePoolWithTag( pFcb, AFS_FCB_ALLOCATION_TAG);
 
     return;
 }
@@ -1176,10 +1176,10 @@ try_exit:
                 if ( pCcb->NPCcb != NULL)
                 {
 
-                    AFSExFreePool( pCcb->NPCcb);
+                    AFSExFreePoolWithTag( pCcb->NPCcb, AFS_CCB_NP_ALLOCATION_TAG);
                 }
 
-                AFSExFreePool( pCcb);
+                AFSExFreePoolWithTag( pCcb, AFS_CCB_ALLOCATION_TAG);
             }
 
             *Ccb = NULL;
@@ -1254,13 +1254,13 @@ AFSRemoveCcb( IN AFSFcb *Fcb,
     if( Ccb->MaskName.Buffer != NULL)
     {
 
-        AFSExFreePool( Ccb->MaskName.Buffer);
+        AFSExFreePoolWithTag( Ccb->MaskName.Buffer, AFS_GENERIC_MEMORY_6_TAG);
     }
 
     if( BooleanFlagOn( Ccb->Flags, CCB_FLAG_FREE_FULL_PATHNAME))
     {
 
-        AFSExFreePool( Ccb->FullFileName.Buffer);
+        AFSExFreePoolWithTag( Ccb->FullFileName.Buffer, 0);
     }
 
     //
@@ -1278,7 +1278,7 @@ AFSRemoveCcb( IN AFSFcb *Fcb,
     if( Ccb->DirectorySnapshot != NULL)
     {
 
-        AFSExFreePool( Ccb->DirectorySnapshot);
+        AFSExFreePoolWithTag( Ccb->DirectorySnapshot, AFS_DIR_SNAPSHOT_TAG);
 
         Ccb->DirectorySnapshot = NULL;
     }
@@ -1286,7 +1286,7 @@ AFSRemoveCcb( IN AFSFcb *Fcb,
     if( Ccb->NotifyMask.Buffer != NULL)
     {
 
-        AFSExFreePool( Ccb->NotifyMask.Buffer);
+        AFSExFreePoolWithTag( Ccb->NotifyMask.Buffer, AFS_GENERIC_MEMORY_7_TAG);
     }
 
     AFSReleaseResource( &Ccb->NPCcb->CcbLock);
@@ -1297,9 +1297,9 @@ AFSRemoveCcb( IN AFSFcb *Fcb,
 
     ExDeleteResourceLite( &Ccb->NPCcb->CcbLock);
 
-    AFSExFreePool( Ccb->NPCcb);
+    AFSExFreePoolWithTag( Ccb->NPCcb, AFS_CCB_NP_ALLOCATION_TAG);
 
-    AFSExFreePool( Ccb);
+    AFSExFreePoolWithTag( Ccb, AFS_CCB_ALLOCATION_TAG);
 
     return ntStatus;
 }
index 4baec3b..fb3d23f 100644 (file)
@@ -1184,13 +1184,13 @@ try_exit:
 
                 ExDeleteResourceLite( &pNonPagedDirEntry->Lock);
 
-                AFSExFreePool( pNonPagedDirEntry);
+                AFSExFreePoolWithTag( pNonPagedDirEntry, AFS_DIR_ENTRY_NP_TAG);
             }
 
             if( pDirNode != NULL)
             {
 
-                AFSExFreePool( pDirNode);
+                AFSExFreePoolWithTag( pDirNode, AFS_DIR_ENTRY_TAG);
 
                 pDirNode = NULL;
             }
@@ -1413,7 +1413,7 @@ try_exit:
         if( pDirEntry != NULL)
         {
 
-            AFSExFreePool( pDirEntry);
+            AFSExFreePoolWithTag( pDirEntry, AFS_GENERIC_MEMORY_2_TAG);
         }
     }
 
@@ -1551,7 +1551,7 @@ try_exit:
         if( pDirEntry != NULL)
         {
 
-            AFSExFreePool( pDirEntry);
+            AFSExFreePoolWithTag( pDirEntry, AFS_GENERIC_MEMORY_2_TAG);
         }
     }
 
@@ -2442,7 +2442,7 @@ AFSSubstituteNameInPath( IN OUT UNICODE_STRING *FullPathName,
 
         if( FreePathName)
         {
-            AFSExFreePool( FullPathName->Buffer);
+            AFSExFreePoolWithTag( FullPathName->Buffer, 0);
         }
 
         *FullPathName = uniPathName;
@@ -3155,7 +3155,7 @@ AFSVerifyEntry( IN GUID *AuthGroup,
         if( pDirEnumEntry != NULL)
         {
 
-            AFSExFreePool( pDirEnumEntry);
+            AFSExFreePoolWithTag( pDirEnumEntry, AFS_GENERIC_MEMORY_2_TAG);
         }
     }
 
@@ -3761,7 +3761,7 @@ AFSUpdateMetaData( IN AFSDirectoryCB *DirEntry,
             if( BooleanFlagOn( DirEntry->Flags, AFS_DIR_RELEASE_TARGET_NAME_BUFFER) &&
                 DirEntry->NameInformation.TargetName.Buffer != NULL)
             {
-                AFSExFreePool( DirEntry->NameInformation.TargetName.Buffer);
+                AFSExFreePoolWithTag( DirEntry->NameInformation.TargetName.Buffer, AFS_NAME_BUFFER_FIVE_TAG);
             }
 
             ClearFlag( DirEntry->Flags, AFS_DIR_RELEASE_TARGET_NAME_BUFFER);
@@ -4241,7 +4241,7 @@ AFSValidateEntry( IN AFSDirectoryCB *DirEntry,
         if( pDirEnumEntry != NULL)
         {
 
-            AFSExFreePool( pDirEnumEntry);
+            AFSExFreePoolWithTag( pDirEnumEntry, AFS_GENERIC_MEMORY_2_TAG);
         }
     }
 
@@ -4870,7 +4870,7 @@ AFSEnumerateGlobalRoot( IN GUID *AuthGroup)
             pDirGlobalDirNode = (AFSDirectoryCB *)pDirGlobalDirNode->ListEntry.fLink;
         }
 
-        AFSExFreePool( uniFullName.Buffer);
+        AFSExFreePoolWithTag( uniFullName.Buffer, 0);
 
 try_exit:
 
@@ -4950,7 +4950,7 @@ AFSUpdateTargetName( IN OUT UNICODE_STRING *TargetName,
             if( BooleanFlagOn( *Flags, AFS_DIR_RELEASE_TARGET_NAME_BUFFER))
             {
 
-                AFSExFreePool( TargetName->Buffer);
+                AFSExFreePoolWithTag( TargetName->Buffer, AFS_NAME_BUFFER_FIVE_TAG);
             }
 
             TargetName->MaximumLength = NameLength;
@@ -5313,7 +5313,7 @@ AFSFreeNameArray( IN AFSNameArrayHdr *NameArray)
                           lCount);
         }
 
-        AFSExFreePool( NameArray);
+        AFSExFreePoolWithTag( NameArray, AFS_NAME_ARRAY_TAG);
     }
 
     return ntStatus;
@@ -5939,7 +5939,7 @@ try_exit:
             if ( pDirNode != NULL)
             {
 
-                AFSExFreePool( pDirNode);
+                AFSExFreePoolWithTag( pDirNode, AFS_DIR_ENTRY_TAG);
             }
 
             if ( pObjectInfoCB != NULL)
@@ -6366,7 +6366,7 @@ try_exit:
         if( pDirEntry != NULL)
         {
 
-            AFSExFreePool( pDirEntry);
+            AFSExFreePoolWithTag( pDirEntry, AFS_GENERIC_MEMORY_2_TAG);
         }
 
         if( pVolumeCB != NULL)
@@ -6402,10 +6402,10 @@ try_exit:
                 pwchBuffer != (WCHAR *)((char *)uniFullPathName.Buffer - ulNameDifference))
             {
 
-                AFSExFreePool( uniFullPathName.Buffer);
+                AFSExFreePoolWithTag( uniFullPathName.Buffer, 0);
             }
 
-            AFSExFreePool( pwchBuffer);
+            AFSExFreePoolWithTag( pwchBuffer, 0);
         }
     }
 
@@ -6444,7 +6444,7 @@ AFSAllocateObjectInfo( IN AFSObjectInfoCB *ParentObjectInfo,
         if( pObjectInfo->NonPagedInfo == NULL)
         {
 
-            AFSExFreePool( pObjectInfo);
+            AFSExFreePoolWithTag( pObjectInfo, AFS_OBJECT_INFO_TAG);
 
             try_return( pObjectInfo = NULL);
         }
@@ -6616,9 +6616,9 @@ AFSDeleteObjectInfo( IN AFSObjectInfoCB *ObjectInfo)
 
     ExDeleteResourceLite( &ObjectInfo->NonPagedInfo->DirectoryNodeHdrLock);
 
-    AFSExFreePool( ObjectInfo->NonPagedInfo);
+    AFSExFreePoolWithTag( ObjectInfo->NonPagedInfo, AFS_NP_OBJECT_INFO_TAG);
 
-    AFSExFreePool( ObjectInfo);
+    AFSExFreePoolWithTag( ObjectInfo, AFS_OBJECT_INFO_TAG);
 
     return;
 }
@@ -6888,7 +6888,7 @@ try_exit:
         if( pDirEntry != NULL)
         {
 
-            AFSExFreePool( pDirEntry);
+            AFSExFreePoolWithTag( pDirEntry, AFS_GENERIC_MEMORY_2_TAG);
         }
 
         if( pVolumeCB != NULL)
@@ -6924,10 +6924,10 @@ try_exit:
                 pwchBuffer != (WCHAR *)((char *)uniFullPathName.Buffer - ulNameDifference))
             {
 
-                AFSExFreePool( uniFullPathName.Buffer);
+                AFSExFreePoolWithTag( uniFullPathName.Buffer, 0);
             }
 
-            AFSExFreePool( pwchBuffer);
+            AFSExFreePoolWithTag( pwchBuffer, 0);
         }
     }
 
@@ -7204,7 +7204,7 @@ AFSUpdateDirEntryName( IN AFSDirectoryCB *DirectoryCB,
             if( BooleanFlagOn( DirectoryCB->Flags, AFS_DIR_RELEASE_NAME_BUFFER))
             {
 
-                AFSExFreePool( DirectoryCB->NameInformation.FileName.Buffer);
+                AFSExFreePoolWithTag( DirectoryCB->NameInformation.FileName.Buffer, 0);
 
                 ClearFlag( DirectoryCB->Flags, AFS_DIR_RELEASE_NAME_BUFFER);
 
@@ -7770,7 +7770,7 @@ AFSInitializeLibrary( IN AFSLibraryInitCB *LibraryInit)
 
         AFSExAllocatePoolWithTag = LibraryInit->AFSExAllocatePoolWithTag;
 
-        AFSExFreePool = LibraryInit->AFSExFreePool;
+        AFSExFreePoolWithTag = LibraryInit->AFSExFreePoolWithTag;
 
         AFSDumpTraceFilesFnc = LibraryInit->AFSDumpTraceFiles;
 
index 19949d6..32f5745 100644 (file)
@@ -382,7 +382,7 @@ AFSCompleteIo( IN AFSGatherIo *Gather,
         else
         {
 
-            AFSExFreePool( Gather);
+            AFSExFreePoolWithTag( Gather, AFS_GATHER_TAG);
         }
     }
 }
index f13e308..5727b81 100644 (file)
@@ -552,7 +552,7 @@ AFSLocateNameEntry( IN GUID *AuthGroup,
                         if( pTmpBuffer != NULL)
                         {
 
-                            AFSExFreePool( pTmpBuffer);
+                            AFSExFreePoolWithTag( pTmpBuffer, 0);
                         }
 
                         AFSReleaseResource( &pDirEntry->NonPaged->Lock);
@@ -697,7 +697,7 @@ AFSLocateNameEntry( IN GUID *AuthGroup,
                         if( pTmpBuffer != NULL)
                         {
 
-                            AFSExFreePool( pTmpBuffer);
+                            AFSExFreePoolWithTag( pTmpBuffer, 0);
                         }
 
                         AFSReleaseResource( &pDirEntry->NonPaged->Lock);
@@ -1182,7 +1182,7 @@ AFSLocateNameEntry( IN GUID *AuthGroup,
                 uniSearchName.Buffer != NULL)
             {
 
-                AFSExFreePool( uniSearchName.Buffer);
+                AFSExFreePoolWithTag( uniSearchName.Buffer, 0);
 
                 bSubstituteName = FALSE;
 
@@ -1455,7 +1455,7 @@ AFSLocateNameEntry( IN GUID *AuthGroup,
                             if( bSubstituteName)
                             {
 
-                                AFSExFreePool( uniSearchName.Buffer);
+                                AFSExFreePoolWithTag( uniSearchName.Buffer, 0);
 
                                 uniSearchName = uniComponentName;
 
@@ -1955,7 +1955,7 @@ try_exit:
             if( RootPathName->Buffer != uniFullPathName.Buffer)
             {
 
-                AFSExFreePool( uniFullPathName.Buffer);
+                AFSExFreePoolWithTag( uniFullPathName.Buffer, 0);
             }
         }
         else
@@ -1990,7 +1990,7 @@ try_exit:
             uniSearchName.Buffer != NULL)
         {
 
-            AFSExFreePool( uniSearchName.Buffer);
+            AFSExFreePoolWithTag( uniSearchName.Buffer, 0);
         }
     }
 
@@ -2444,13 +2444,13 @@ AFSDeleteDirEntry( IN AFSObjectInfoCB *ParentObjectInfo,
         if( BooleanFlagOn( DirEntry->Flags, AFS_DIR_RELEASE_NAME_BUFFER))
         {
 
-            AFSExFreePool( DirEntry->NameInformation.FileName.Buffer);
+            AFSExFreePoolWithTag( DirEntry->NameInformation.FileName.Buffer, 0);
         }
 
         if( BooleanFlagOn( DirEntry->Flags, AFS_DIR_RELEASE_TARGET_NAME_BUFFER))
         {
 
-            AFSExFreePool( DirEntry->NameInformation.TargetName.Buffer);
+            AFSExFreePoolWithTag( DirEntry->NameInformation.TargetName.Buffer, 0);
         }
 
         //
@@ -2474,13 +2474,13 @@ AFSDeleteDirEntry( IN AFSObjectInfoCB *ParentObjectInfo,
 
         ExDeleteResourceLite( &DirEntry->NonPaged->Lock);
 
-        AFSExFreePool( DirEntry->NonPaged);
+        AFSExFreePoolWithTag( DirEntry->NonPaged, AFS_DIR_ENTRY_NP_TAG);
 
         //
         // Free up the dir entry
         //
 
-        AFSExFreePool( DirEntry);
+        AFSExFreePoolWithTag( DirEntry, AFS_DIR_ENTRY_TAG);
     }
 
     return ntStatus;
@@ -2937,7 +2937,7 @@ AFSParseName( IN PIRP Irp,
                                   "AFSParseName (%08lX) Failed to initialize name array\n",
                                   Irp);
 
-                    AFSExFreePool( uniFullName.Buffer);
+                    AFSExFreePoolWithTag( uniFullName.Buffer, 0);
 
                     try_return( ntStatus = STATUS_INSUFFICIENT_RESOURCES);
                 }
@@ -2964,7 +2964,7 @@ AFSParseName( IN PIRP Irp,
                                   "AFSParseName (%08lX) Failed to initialize name array\n",
                                   Irp);
 
-                    AFSExFreePool( uniFullName.Buffer);
+                    AFSExFreePoolWithTag( uniFullName.Buffer, 0);
 
                     try_return( ntStatus = STATUS_INSUFFICIENT_RESOURCES);
                 }
@@ -2982,7 +2982,7 @@ AFSParseName( IN PIRP Irp,
                               "AFSParseName (%08lX) Failed to populate name array\n",
                               Irp);
 
-                AFSExFreePool( uniFullName.Buffer);
+                AFSExFreePoolWithTag( uniFullName.Buffer, 0);
 
                 try_return( ntStatus);
             }
@@ -4047,7 +4047,7 @@ try_exit:
         if( pDirEnumEntry != NULL)
         {
 
-            AFSExFreePool( pDirEnumEntry);
+            AFSExFreePoolWithTag( pDirEnumEntry, AFS_GENERIC_MEMORY_31_TAG);
         }
     }
 
@@ -4310,7 +4310,7 @@ try_exit:
         if( pDirEntry)
         {
 
-            AFSExFreePool( pDirEntry);
+            AFSExFreePoolWithTag( pDirEntry, AFS_GENERIC_MEMORY_2_TAG);
         }
     }
 
@@ -4677,7 +4677,7 @@ AFSProcessDFSLink( IN AFSDirectoryCB *DirEntry,
         if( FileObject->FileName.Buffer != NULL)
         {
 
-            AFSExFreePool( FileObject->FileName.Buffer);
+            AFSExFreePoolWithTag( FileObject->FileName.Buffer, 0);
         }
 
         FileObject->FileName = uniReparseName;
@@ -4703,7 +4703,7 @@ try_exit:
         if ( pDirEntry)
         {
 
-            AFSExFreePool( pDirEntry);
+            AFSExFreePoolWithTag( pDirEntry, AFS_GENERIC_MEMORY_2_TAG);
         }
     }
 
index 449dc53..1b27fc7 100644 (file)
@@ -512,12 +512,12 @@ AFSCancelConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
         if( pConnection->Comment.Buffer != NULL)
         {
 
-            AFSExFreePool( pConnection->Comment.Buffer);
+            AFSExFreePoolWithTag( pConnection->Comment.Buffer, 0);
         }
 
         ConnectionResult->LocalName = pConnection->LocalName;
 
-        AFSExFreePool( pConnection);
+        AFSExFreePoolWithTag( pConnection, AFS_PROVIDER_CB);
 
         ConnectionResult->Status = WN_SUCCESS;
 
@@ -983,7 +983,7 @@ try_exit:
         if( uniRemoteName.Buffer != NULL)
         {
 
-            AFSExFreePool( uniRemoteName.Buffer);
+            AFSExFreePoolWithTag( uniRemoteName.Buffer, 0);
         }
     }
 
@@ -1702,7 +1702,7 @@ AFSGetConnectionInfo( IN AFSNetworkProviderConnectionCB *ConnectCB,
             // Don't need this
             //
 
-            AFSExFreePool( pDirEnumEntry);
+            AFSExFreePoolWithTag( pDirEnumEntry, AFS_GENERIC_MEMORY_3_TAG);
 
             //
             // The share name is valid
@@ -1755,7 +1755,7 @@ AFSGetConnectionInfo( IN AFSNetworkProviderConnectionCB *ConnectCB,
 
             AFSReleaseResource( AFSGlobalRoot->ObjectInformation.Specific.Directory.DirectoryNodeHdr.TreeLock);
 
-            AFSExFreePool( uniFullName.Buffer);
+            AFSExFreePoolWithTag( uniFullName.Buffer, 0);
 
             AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
                           AFS_TRACE_LEVEL_VERBOSE,
@@ -1887,7 +1887,7 @@ try_exit:
         if ( uniRemainingPathLocal.Buffer )
         {
 
-            AFSExFreePool( uniRemainingPathLocal.Buffer);
+            AFSExFreePoolWithTag( uniRemainingPathLocal.Buffer, 0);
         }
     }
 
index 775c9aa..5f2da9b 100644 (file)
@@ -737,12 +737,12 @@ try_exit:
 
         if (pGatherIo)
         {
-            AFSExFreePool(pGatherIo);
+            AFSExFreePoolWithTag(pGatherIo, AFS_GATHER_TAG);
         }
 
         if (NULL != pIoRuns && stIoRuns != pIoRuns)
         {
-            AFSExFreePool(pIoRuns);
+            AFSExFreePoolWithTag(pIoRuns, AFS_IO_RUN_TAG);
         }
 
         if (bCompleteIrp)
index 9239c40..5e07af5 100644 (file)
@@ -1193,9 +1193,9 @@ AFSPrimaryVolumeWorkerThread( IN PVOID Context)
 
                                         ExDeleteResourceLite( &pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB->NonPaged->Lock);
 
-                                        AFSExFreePool( pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB->NonPaged);
+                                        AFSExFreePoolWithTag( pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB->NonPaged, AFS_DIR_ENTRY_NP_TAG);
 
-                                        AFSExFreePool( pCurrentObject->Specific.Directory.PIOCtlDirectoryCB);
+                                        AFSExFreePoolWithTag( pCurrentObject->Specific.Directory.PIOCtlDirectoryCB, AFS_DIR_ENTRY_TAG);
                                     }
 
                                     AFSDbgLogMsg( AFS_SUBSYSTEM_CLEANUP_PROCESSING,
@@ -1416,9 +1416,9 @@ AFSPrimaryVolumeWorkerThread( IN PVOID Context)
 
                                             ExDeleteResourceLite( &pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB->NonPaged->Lock);
 
-                                            AFSExFreePool( pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB->NonPaged);
+                                            AFSExFreePoolWithTag( pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB->NonPaged, AFS_DIR_ENTRY_NP_TAG);
 
-                                            AFSExFreePool( pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB);
+                                            AFSExFreePoolWithTag( pCurrentChildObject->Specific.Directory.PIOCtlDirectoryCB, AFS_DIR_ENTRY_TAG);
                                         }
 
                                         AFSDbgLogMsg( AFS_SUBSYSTEM_CLEANUP_PROCESSING,
index f9e2e96..b774a52 100644 (file)
@@ -1372,13 +1372,13 @@ try_exit:
 
         if( pGatherIo)
         {
-            AFSExFreePool(pGatherIo);
+            AFSExFreePoolWithTag(pGatherIo, AFS_GATHER_TAG);
         }
 
         if( NULL != pIoRuns &&
             stIoRuns != pIoRuns)
         {
-            AFSExFreePool(pIoRuns);
+            AFSExFreePoolWithTag(pIoRuns, AFS_IO_RUN_TAG);
         }
 
         if( bCompleteIrp)
@@ -1856,7 +1856,7 @@ try_exit:
         if( pIoRequest != NULL)
         {
 
-            AFSExFreePool( pIoRequest);
+            AFSExFreePoolWithTag( pIoRequest, AFS_GENERIC_MEMORY_14_TAG);
         }
     }
 
index 3d67152..a9b23fb 100644 (file)
@@ -81,7 +81,7 @@ extern PAFSAddConnectionEx AFSAddConnectionEx;
 
 extern PAFSExAllocatePoolWithTag   AFSExAllocatePoolWithTag;
 
-extern PAFSExFreePool      AFSExFreePool;
+extern PAFSExFreePoolWithTag      AFSExFreePoolWithTag;
 
 extern PAFSRetrieveAuthGroup AFSRetrieveAuthGroupFnc;