[ros-diffs] [hpoussin] 35834: Replace some ExFreePool by ExFreePoolWithTag

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Sun Aug 31 17:29:21 CEST 2008


Author: hpoussin
Date: Sun Aug 31 10:29:21 2008
New Revision: 35834

URL: http://svn.reactos.org/svn/reactos?rev=35834&view=rev
Log:
Replace some ExFreePool by ExFreePoolWithTag

Modified:
    trunk/reactos/ntoskrnl/config/cmalloc.c
    trunk/reactos/ntoskrnl/config/cmconfig.c
    trunk/reactos/ntoskrnl/config/cmse.c
    trunk/reactos/ntoskrnl/config/cmsysini.c
    trunk/reactos/ntoskrnl/config/i386/cmhardwr.c
    trunk/reactos/ntoskrnl/ex/init.c
    trunk/reactos/ntoskrnl/fstub/disksup.c
    trunk/reactos/ntoskrnl/io/iomgr/arcname.c
    trunk/reactos/ntoskrnl/io/iomgr/device.c
    trunk/reactos/ntoskrnl/io/iomgr/driver.c
    trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c
    trunk/reactos/ntoskrnl/io/iomgr/file.c
    trunk/reactos/ntoskrnl/io/iomgr/iofunc.c
    trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c
    trunk/reactos/ntoskrnl/io/iomgr/irp.c
    trunk/reactos/ntoskrnl/mm/section.c
    trunk/reactos/ntoskrnl/mm/sysldr.c
    trunk/reactos/ntoskrnl/ob/obdir.c
    trunk/reactos/ntoskrnl/ob/obhandle.c
    trunk/reactos/ntoskrnl/ob/obname.c
    trunk/reactos/ntoskrnl/ob/obsecure.c
    trunk/reactos/ntoskrnl/ob/obwait.c
    trunk/reactos/ntoskrnl/rtl/libsupp.c
    trunk/reactos/ntoskrnl/se/sd.c

Modified: trunk/reactos/ntoskrnl/config/cmalloc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmalloc.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmalloc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmalloc.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -62,7 +62,7 @@
     if (!Kcb->PrivateAlloc)
     {
         /* Free it from the pool */
-        ExFreePool(Kcb);
+        ExFreePoolWithTag(Kcb, TAG_CM);
         return;
     }
     
@@ -99,7 +99,7 @@
         }
         
         /* Free the page */
-        ExFreePool(AllocPage);
+        ExFreePoolWithTag(AllocPage, TAG_CM);
     }
     
     /* Release the lock */
@@ -296,7 +296,7 @@
         }
         
         /* Now free the page */
-        ExFreePool(AllocPage);
+        ExFreePoolWithTag(AllocPage, TAG_CM);
     }
     
     /* Release the lock */

Modified: trunk/reactos/ntoskrnl/config/cmconfig.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmconfig.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmconfig.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmconfig.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -386,7 +386,7 @@
     }
 
     /* Close our handle, free the buffer and return status */
-    ExFreePool(CmpConfigurationData);
+    ExFreePoolWithTag(CmpConfigurationData, TAG_CM);
     NtClose(KeyHandle);
     return Status;
 }

Modified: trunk/reactos/ntoskrnl/config/cmse.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmse.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmse.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmse.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -129,8 +129,8 @@
     if (!NT_SUCCESS(Status)) KeBugCheckEx(REGISTRY_ERROR, 11, 8, Status, 0);
 
     /* Free the SIDs and original ACL */
-    for (i = 0; i < 4; i++) ExFreePool(Sid[i]);
-    ExFreePool(Acl);
+    for (i = 0; i < 4; i++) ExFreePoolWithTag(Sid[i], TAG_CM);
+    ExFreePoolWithTag(Acl, TAG_CM);
 
     /* Return the security descriptor */
     return SecurityDescriptor;

Modified: trunk/reactos/ntoskrnl/config/cmsysini.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmsysini.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmsysini.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -804,7 +804,7 @@
                                  SecurityDescriptor);
 
     /* Free the security descriptor */
-    ExFreePool(SecurityDescriptor);
+    ExFreePoolWithTag(SecurityDescriptor, TAG_CM);
     if (!NT_SUCCESS(Status)) return FALSE;
 
     /* Add the hive to the hive list */
@@ -944,7 +944,7 @@
                             0,
                             0,
                             (PVOID*)&RootKey);
-    ExFreePool(SecurityDescriptor);
+    ExFreePoolWithTag(SecurityDescriptor, TAG_CM);
     if (!NT_SUCCESS(Status)) return FALSE;
 
     /* Sanity check, and get the key cell */
@@ -1041,7 +1041,7 @@
         if (!NT_SUCCESS(Status))
         {
             /* Fail */
-            ExFreePool(ValueInfo);
+            ExFreePoolWithTag(ValueInfo, TAG_CM);
             return Status;
         }
 
@@ -1050,7 +1050,7 @@
                       ValueInfo->Data,
                       ValueInfo->DataLength);
         ConfigPath[ValueInfo->DataLength / sizeof(WCHAR)] = UNICODE_NULL;
-        ExFreePool(ValueInfo);
+        ExFreePoolWithTag(ValueInfo, TAG_CM);
     }
     else
     {
@@ -1356,7 +1356,7 @@
     }
     
     /* Get rid of the SD */
-    ExFreePool(SecurityDescriptor);
+    ExFreePoolWithTag(SecurityDescriptor, TAG_CM);
 
     /* FIXME: Link SECURITY to SAM */
     
@@ -1541,7 +1541,7 @@
     /* FIXME: Add to HiveList key */
     
     /* Free the security descriptor */
-    ExFreePool(SecurityDescriptor);
+    ExFreePoolWithTag(SecurityDescriptor, TAG_CM);
 
     /* Fill out the Hardware key with the ARC Data from the Loader */
     Status = CmpInitializeHardwareConfiguration(KeLoaderBlock);
@@ -1568,7 +1568,7 @@
     }
 
     /* Free the load options */
-    ExFreePool(CmpLoadOptions.Buffer);
+    ExFreePoolWithTag(CmpLoadOptions.Buffer, TAG_CM);
 
     /* If we got here, all went well */
     return TRUE;

Modified: trunk/reactos/ntoskrnl/config/i386/cmhardwr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/i386/cmhardwr.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/config/i386/cmhardwr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/i386/cmhardwr.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -546,7 +546,7 @@
         }
 
         /* Free the configuration data */
-        ExFreePool(CmpConfigurationData);
+        ExFreePoolWithTag(CmpConfigurationData, TAG_CM);
     }
 
     /* Open physical memory */
@@ -824,7 +824,7 @@
     ZwClose(SectionHandle);
 
     /* Free the BIOS version string buffer */
-    if (BiosVersion) ExFreePool(BiosVersion);
+    if (BiosVersion) ExFreePoolWithTag(BiosVersion, TAG_CM);
 
 Quickie:
     /* Close the procesor handle */

Modified: trunk/reactos/ntoskrnl/ex/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -324,7 +324,7 @@
     RtlCopyMemory(SectionBase, ExpNlsTableBase, ExpNlsTableSize);
 
     /* Free the previously allocated buffer and set the new location */
-    ExFreePool(ExpNlsTableBase);
+    ExFreePoolWithTag(ExpNlsTableBase, TAG('R', 't', 'l', 'i'));
     ExpNlsTableBase = SectionBase;
 
     /* Initialize the NLS Tables */

Modified: trunk/reactos/ntoskrnl/fstub/disksup.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fstub/disksup.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -948,7 +948,7 @@
     if (!Irp)
     {
         /* Fail, free the event */
-        ExFreePool(Event);
+        ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
         return STATUS_INSUFFICIENT_RESOURCES;
     }
 
@@ -977,7 +977,7 @@
         if (!Irp)
         {
             /* Fail, free the event */
-            ExFreePool(Event);
+            ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
             return STATUS_INSUFFICIENT_RESOURCES;
         }
 
@@ -1000,7 +1000,7 @@
     }
 
     /* Free the event and return the Status */
-    ExFreePool(Event);
+    ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
     return Status;
 }
 
@@ -1200,7 +1200,7 @@
 
 Cleanup:
     /* Free all the pointers */
-    if (Event) ExFreePool(Event);
+    if (Event) ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
     if (IoStatusBlock) ExFreePool(IoStatusBlock);
     if (DiskGeometry) ExFreePool(DiskGeometry);
     return;
@@ -1251,7 +1251,7 @@
     if (!Irp)
     {
         /* Failed */
-        ExFreePool(Buffer);
+        ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
         return;
     }
 
@@ -1275,7 +1275,7 @@
         if (((PUSHORT)Buffer)[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE)
         {
             /* Failed */
-            ExFreePool(Buffer);
+            ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
             return;
         }
 
@@ -1287,7 +1287,7 @@
         if (PartitionDescriptor->PartitionType != MbrTypeIdentifier)
         {
             /* It's not, free our buffer */
-        ExFreePool(Buffer);
+            ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
         }
         else
         {
@@ -1367,7 +1367,7 @@
     Status = HalpGetFullGeometry(DeviceObject, &DiskGeometry, &MaxOffset);
     if (!NT_SUCCESS(Status))
     {
-        ExFreePool(*PartitionBuffer);
+        ExFreePoolWithTag(*PartitionBuffer, TAG_FILE_SYSTEM);
         *PartitionBuffer = NULL;
         return Status;
     }
@@ -1383,7 +1383,8 @@
     if (!Buffer)
     {
         /* Fail, free the input buffer */
-        ExFreePool(*PartitionBuffer);
+        ExFreePoolWithTag(*PartitionBuffer, TAG_FILE_SYSTEM);
+        *PartitionBuffer = NULL;
         return STATUS_INSUFFICIENT_RESOURCES;
     }
 
@@ -1549,7 +1550,7 @@
                               BufferSize);
 
                 /* Free the old buffer and set this one as the new one */
-                ExFreePool(*PartitionBuffer);
+                ExFreePoolWithTag(*PartitionBuffer, TAG_FILE_SYSTEM);
                 *PartitionBuffer = DriveLayoutInfo;
 
                 /* Double the size */
@@ -1732,8 +1733,8 @@
     if (!i) (*PartitionBuffer)->Signature = 0;
 
     /* Free the buffer and check for success */
-    if (Buffer) ExFreePool(Buffer);
-    if (!NT_SUCCESS(Status)) ExFreePool(*PartitionBuffer);
+    if (Buffer) ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
+    if (!NT_SUCCESS(Status)) ExFreePoolWithTag(*PartitionBuffer, TAG_FILE_SYSTEM);
 
     /* Return status */
     return Status;
@@ -2212,7 +2213,7 @@
     }
 
     /* If we had a buffer, free it, then return status */
-    if (Buffer) ExFreePool(Buffer);
+    if (Buffer) ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
     return Status;
 }
 

Modified: trunk/reactos/ntoskrnl/io/iomgr/arcname.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/arcname.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/arcname.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/arcname.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -242,8 +242,8 @@
     if (!NT_SUCCESS(Status))
     {
         /* Try again */
-        ExFreePool(PartitionBuffer);
-        ExFreePool(DriveLayout);
+        ExFreePoolWithTag(PartitionBuffer, TAG_IO);
+        ExFreePoolWithTag(DriveLayout, TAG_FILE_SYSTEM);
         return FALSE;
     }
 
@@ -257,8 +257,8 @@
     *PartitionCount = DriveLayout->PartitionCount;
 
     /* Free the buffer */
-    ExFreePool(PartitionBuffer);
-    ExFreePool(DriveLayout);
+    ExFreePoolWithTag(PartitionBuffer, TAG_IO);
+    ExFreePoolWithTag(DriveLayout, TAG_FILE_SYSTEM);
     return TRUE;
 }
 
@@ -574,7 +574,7 @@
         }
 
         /* Free the buffer */
-        ExFreePool(PartitionBuffer);
+        ExFreePoolWithTag(PartitionBuffer, TAG_IO);
     }
 
     /* Return success */

Modified: trunk/reactos/ntoskrnl/io/iomgr/device.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/device.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/device.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/device.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -122,7 +122,7 @@
         }
 
         /* Free the shutdown entry and reset the event */
-        ExFreePool(ShutdownEntry);
+        ExFreePoolWithTag(ShutdownEntry, TAG_SHUTDOWN_ENTRY);
         KeClearEvent(&Event);
 
         /* Go to the next entry */
@@ -317,7 +317,7 @@
         if (DeviceObject->SecurityDescriptor)
         {
             /* Free it */
-            ExFreePool(DeviceObject->SecurityDescriptor);
+            ExFreePoolWithTag(DeviceObject->SecurityDescriptor, TAG_SD);
         }
 
         /* Remove the device from the list */
@@ -1328,7 +1328,7 @@
             NextEntry = NextEntry->Blink;
 
             /* Free the entry */
-            ExFreePool(ShutdownEntry);
+            ExFreePoolWithTag(ShutdownEntry, TAG_SHUTDOWN_ENTRY);
         }
 
         /* Go to the next entry */
@@ -1352,7 +1352,7 @@
             NextEntry = NextEntry->Blink;
 
             /* Free the entry */
-            ExFreePool(ShutdownEntry);
+            ExFreePoolWithTag(ShutdownEntry, TAG_SHUTDOWN_ENTRY);
         }
 
         /* Go to the next entry */

Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -28,6 +28,8 @@
    RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\HARDWARE\\DESCRIPTION\\SYSTEM");
 
 POBJECT_TYPE IoDriverObjectType = NULL;
+
+#define TAG_RTLREGISTRY TAG('R', 'q', 'r', 'v')
 
 extern BOOLEAN ExpInTextModeSetup;
 
@@ -246,7 +248,7 @@
       RtlAppendUnicodeStringToString(ImagePath, &InputImagePath);
 
       /* Free caller's string */
-      RtlFreeUnicodeString(&InputImagePath);
+      ExFreePoolWithTag(InputImagePath.Buffer, TAG_RTLREGISTRY);
    }
 
    return STATUS_SUCCESS;

Modified: trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/drvrlist.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -36,6 +36,8 @@
 
 /*  BOOLEAN ServiceRunning;*/	// needed ??
 } SERVICE, *PSERVICE;
+
+#define TAG_RTLREGISTRY TAG('R', 'q', 'r', 'v')
 
 /* GLOBALS ********************************************************************/
 
@@ -205,11 +207,11 @@
        */
       if (Service->ServiceGroup.Buffer)
         {
-          ExFreePool(Service->ServiceGroup.Buffer);
+          ExFreePoolWithTag(Service->ServiceGroup.Buffer, TAG_RTLREGISTRY);
         }
       if (Service->ImagePath.Buffer)
         {
-          ExFreePool(Service->ImagePath.Buffer);
+          ExFreePoolWithTag(Service->ImagePath.Buffer, TAG_RTLREGISTRY);
         }
       ExFreePool(Service);
       return(Status);

Modified: trunk/reactos/ntoskrnl/io/iomgr/file.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/file.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/file.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/file.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -1031,7 +1031,7 @@
         /* Clear the file name */
         if (FileObject->FileName.Buffer)
         {
-           ExFreePool(FileObject->FileName.Buffer);
+           ExFreePoolWithTag(FileObject->FileName.Buffer, TAG_IO_NAME);
            FileObject->FileName.Buffer = NULL;
         }
 

Modified: trunk/reactos/ntoskrnl/io/iomgr/iofunc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iofunc.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iofunc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iofunc.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -1890,7 +1890,7 @@
         {
             /* Clear it in the IRP for completion */
             Irp->UserEvent = NULL;
-            ExFreePool(Event);
+            ExFreePoolWithTag(Event, TAG_IO);
         }
 
         /* Set the caller IOSB */

Modified: trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iorsrce.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -179,7 +179,7 @@
       if (!NT_SUCCESS(Status))
       {
          if (ControllerFullInformation != NULL)
-            ExFreePool(ControllerFullInformation);
+            ExFreePoolWithTag(ControllerFullInformation, TAG_IO_RESOURCE);
          return Status;
       }
 
@@ -188,7 +188,7 @@
       MaximumControllerNumber = ControllerFullInformation->SubKeys;
 
       /* Free Memory */
-      ExFreePool(ControllerFullInformation);
+      ExFreePoolWithTag(ControllerFullInformation, TAG_IO_RESOURCE);
       ControllerFullInformation = NULL;
    }
 
@@ -318,7 +318,7 @@
          MaximumPeripheralNumber = PeripheralFullInformation->SubKeys;
 
          /* Free Memory */
-         ExFreePool(PeripheralFullInformation);
+         ExFreePoolWithTag(PeripheralFullInformation, TAG_IO_RESOURCE);
          PeripheralFullInformation = NULL;
       }
 
@@ -400,7 +400,7 @@
             {
                if (PeripheralInformation[PeripheralLoop])
                {
-                  ExFreePool(PeripheralInformation[PeripheralLoop]);
+                  ExFreePoolWithTag(PeripheralInformation[PeripheralLoop], TAG_IO_RESOURCE);
                   PeripheralInformation[PeripheralLoop] = NULL;
                }
             }
@@ -416,7 +416,7 @@
       {
          if (ControllerInformation[ControllerLoop])
          {
-            ExFreePool(ControllerInformation[ControllerLoop]);
+            ExFreePoolWithTag(ControllerInformation[ControllerLoop], TAG_IO_RESOURCE);
             ControllerInformation[ControllerLoop] = NULL;
          }
       }
@@ -498,7 +498,7 @@
    }
 
    /* Deallocate the old Buffer */
-   ExFreePool(FullInformation);
+   ExFreePoolWithTag(FullInformation, TAG_IO_RESOURCE);
 
    /* Try to find a Bus */
    for (BusLoop = 0; NT_SUCCESS(Status); BusLoop++)
@@ -619,7 +619,7 @@
          {
             if (BusInformation[SubBusLoop])
             {
-               ExFreePool(BusInformation[SubBusLoop]);
+               ExFreePoolWithTag(BusInformation[SubBusLoop], TAG_IO_RESOURCE);
                BusInformation[SubBusLoop] = NULL;
             }
          }
@@ -645,7 +645,7 @@
 
    /* Free the last remaining Allocated Memory */
    if (BasicInformation)
-      ExFreePool(BasicInformation);
+      ExFreePoolWithTag(BasicInformation, TAG_IO_RESOURCE);
 
    return Status;
 }
@@ -788,7 +788,7 @@
    }
 
    /* Free Memory */
-   ExFreePool(RootRegKey.Buffer);
+   ExFreePoolWithTag(RootRegKey.Buffer, TAG_IO_RESOURCE);
 
    return Status;
 }

Modified: trunk/reactos/ntoskrnl/io/iomgr/irp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/irp.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/irp.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -1499,7 +1499,7 @@
     if (!(Irp->AllocationFlags & IRP_ALLOCATED_FIXED_SIZE))
     {
         /* Free it */
-        ExFreePool(Irp);
+        ExFreePoolWithTag(Irp, TAG_IRP);
     }
     else
     {
@@ -1528,7 +1528,7 @@
             {
                 /* All lists failed, use the pool */
                 List->L.FreeMisses++;
-                ExFreePool(Irp);
+                ExFreePoolWithTag(Irp, TAG_IRP);
                 Irp = NULL;
             }
         }

Modified: trunk/reactos/ntoskrnl/mm/section.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -136,7 +136,7 @@
     if (!NT_SUCCESS(Status))
     {
         /* Failed, free memory */
-        ExFreePool(ObjectNameInfo);
+        ExFreePoolWithTag(ObjectNameInfo, TAG('M', 'm', ' ', ' '));
         return Status;
     }
 
@@ -2759,7 +2759,7 @@
    }
    else
    {
-      ExFreePool(Buffer);
+      ExFreePoolWithTag(Buffer, TAG('M', 'm', 'X', 'r'));
    }
 
    return Status;
@@ -3168,7 +3168,7 @@
          break;
    }
 
-   ExFreePool(FileHeaderBuffer);
+   ExFreePoolWithTag(FileHeaderBuffer, TAG('M', 'm', 'X', 'r'));
 
    /*
     * No loader handled the format
@@ -3963,7 +3963,7 @@
    {
       CurrentEntry = RemoveHeadList(RegionListHead);
       CurrentRegion = CONTAINING_RECORD(CurrentEntry, MM_REGION, RegionListEntry);
-      ExFreePool(CurrentRegion);
+      ExFreePoolWithTag(CurrentRegion, TAG_MM_REGION);
    }
 
    if (Section->AllocationAttributes & SEC_PHYSICALMEMORY)

Modified: trunk/reactos/ntoskrnl/mm/sysldr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/sysldr.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/sysldr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/sysldr.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -660,7 +660,7 @@
                                          &MissingForwarder);
 
                     /* Free the forwarder name and set the thunk */
-                    ExFreePool(ForwardName);
+                    ExFreePoolWithTag(ForwardName, TAG_LDR_WSTR);
                     Address->u1 = ForwardThunk.u1;
                     break;
                 }
@@ -876,7 +876,7 @@
         {
             /* Failed */
             MiDereferenceImports(LoadedImports);
-            if (LoadedImports) ExFreePool(LoadedImports);
+            if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
             return Status;
         }
 
@@ -997,7 +997,7 @@
                 /* Cleanup and return */
                 RtlFreeUnicodeString(&NameString);
                 MiDereferenceImports(LoadedImports);
-                if (LoadedImports) ExFreePool(LoadedImports);
+                if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
                 return Status;
             }
 
@@ -1030,7 +1030,7 @@
         {
             /* Cleanup and return */
             MiDereferenceImports(LoadedImports);
-            if (LoadedImports) ExFreePool(LoadedImports);
+            if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
             return STATUS_DRIVER_ENTRYPOINT_NOT_FOUND;
         }
 
@@ -1059,7 +1059,7 @@
                 {
                     /* Cleanup and return */
                     MiDereferenceImports(LoadedImports);
-                    if (LoadedImports) ExFreePool(LoadedImports);
+                    if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
                     return Status;
                 }
 
@@ -1091,13 +1091,13 @@
         if (!ImportCount)
         {
             /* Free the list and set it to no imports */
-            ExFreePool(LoadedImports);
+            ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
             LoadedImports = (PVOID)-2;
         }
         else if (ImportCount == 1)
         {
             /* Just one entry, we can free the table and only use our entry */
-            ExFreePool(LoadedImports);
+            ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
             LoadedImports = (PLOAD_IMPORTS)ImportEntry;
         }
         else if (ImportCount != LoadedImports->Count)
@@ -1125,7 +1125,7 @@
                 }
 
                 /* Free the old copy */
-                ExFreePool(LoadedImports);
+                ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
                 LoadedImports = NewImports;
             }
         }
@@ -1834,7 +1834,7 @@
         }
 
         /* Free the entry itself */
-        ExFreePool(LdrEntry);
+        ExFreePoolWithTag(LdrEntry, TAG_MODULE_OBJECT);
         LdrEntry = NULL;
         goto Quickie;
     }
@@ -1924,7 +1924,7 @@
     if (NamePrefix) ExFreePool(PrefixName.Buffer);
 
     /* Free the name buffer and return status */
-    ExFreePool(Buffer);
+    ExFreePoolWithTag(Buffer, TAG_LDR_WSTR);
     return Status;
 }
 

Modified: trunk/reactos/ntoskrnl/ob/obdir.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obdir.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obdir.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ob/obdir.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -326,7 +326,7 @@
     CurrentEntry->ChainLink = NULL;
 
     /* Free it */
-    ExFreePool(CurrentEntry);
+    ExFreePoolWithTag(CurrentEntry, OB_DIR_TAG);
 
     /* Return */
     return TRUE;
@@ -529,7 +529,7 @@
     if (!NT_SUCCESS(Status))
     {
         /* Free the buffer and fail */
-        ExFreePool(LocalBuffer);
+        ExFreePoolWithTag(LocalBuffer, OB_NAME_TAG);
         return Status;
     }
 
@@ -701,7 +701,7 @@
 
     /* Dereference the directory and free our buffer */
     ObDereferenceObject(Directory);
-    ExFreePool(LocalBuffer);
+    ExFreePoolWithTag(LocalBuffer, OB_NAME_TAG);
 
     /* Return status to caller */
     return Status;

Modified: trunk/reactos/ntoskrnl/ob/obhandle.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obhandle.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obhandle.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ob/obhandle.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -289,7 +289,7 @@
     else
     {
         /* Otherwise we had a DB, free it */
-        ExFreePool(OldHandleDatabase);
+        ExFreePoolWithTag(OldHandleDatabase, TAG_OB_HANDLE);
     }
 
     /* Find the end of the copy and zero out the new data */
@@ -2425,7 +2425,7 @@
     if (!NT_SUCCESS(Status))
     {
         /* Fail */
-        ExFreePool(TempBuffer);
+        ExFreePoolWithTag(TempBuffer, TAG_OB_TEMP_STORAGE);
         return Status;
     }
 
@@ -2533,7 +2533,7 @@
     /* Release the object attributes and temporary buffer */
     ObpReleaseObjectCreateInformation(&TempBuffer->ObjectCreateInfo);
     if (ObjectName.Buffer) ObpFreeObjectNameBuffer(&ObjectName);
-    ExFreePool(TempBuffer);
+    ExFreePoolWithTag(TempBuffer, TAG_OB_TEMP_STORAGE);
 
     /* Return status */
     OBTRACE(OB_HANDLE_DEBUG,

Modified: trunk/reactos/ntoskrnl/ob/obname.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obname.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obname.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ob/obname.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -720,7 +720,7 @@
                 if (ObjectNameInfo->Name.Buffer)
                 {
                     /* Free it */
-                    ExFreePool(ObjectNameInfo->Name.Buffer);
+                    ExFreePoolWithTag(ObjectNameInfo->Name.Buffer, OB_NAME_TAG );
                 }
 
                 /* Write new one */

Modified: trunk/reactos/ntoskrnl/ob/obsecure.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obsecure.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obsecure.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ob/obsecure.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -40,7 +40,7 @@
     if (NT_SUCCESS(Status))
     {
         /* Free the old copy */
-        ExFreePool(SecurityDescriptor);
+        ExFreePoolWithTag(SecurityDescriptor, TAG_SD);
 
         /* Set the new pointer */
         ASSERT(NewSd);
@@ -633,7 +633,7 @@
     if (!NT_SUCCESS(Status))
     {
         /* Free the descriptor and tell the caller we failed */
-        ExFreePool(*SecurityDescriptor);
+        ExFreePoolWithTag(*SecurityDescriptor, TAG_SEC_QUERY);
         *MemoryAllocated = FALSE;
     }
 

Modified: trunk/reactos/ntoskrnl/ob/obwait.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obwait.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obwait.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ob/obwait.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -279,7 +279,7 @@
     }
 
     /* Free wait block array */
-    if (WaitBlockArray) ExFreePool(WaitBlockArray);
+    if (WaitBlockArray) ExFreePoolWithTag(WaitBlockArray, TAG_WAIT);
 
     /* Re-enable APCs if needed */
     if (LockInUse) KeLeaveCriticalRegion();

Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/rtl/libsupp.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -12,6 +12,8 @@
 #include <ntoskrnl.h>
 #define NDEBUG
 #include <debug.h>
+
+#define TAG_ATMT TAG('A', 't', 'o', 'T') /* Atom table */
 
 extern ULONG NtGlobalFlag;
 
@@ -482,21 +484,21 @@
 PRTL_ATOM_TABLE_ENTRY
 RtlpAllocAtomTableEntry(ULONG Size)
 {
-   PRTL_ATOM_TABLE_ENTRY Entry = ExAllocatePool(NonPagedPool,
-                                                Size);
-   if (Entry != NULL)
-   {
-      RtlZeroMemory(Entry,
-                    Size);
-   }
-
-   return Entry;
+    PRTL_ATOM_TABLE_ENTRY Entry;
+
+    Entry = ExAllocatePoolWithTag(NonPagedPool, Size, TAG_ATMT);
+    if (Entry != NULL)
+    {
+        RtlZeroMemory(Entry, Size);
+    }
+
+    return Entry;
 }
 
 VOID
 RtlpFreeAtomTableEntry(PRTL_ATOM_TABLE_ENTRY Entry)
 {
-   ExFreePool(Entry);
+    ExFreePoolWithTag(Entry, TAG_ATMT);
 }
 
 VOID

Modified: trunk/reactos/ntoskrnl/se/sd.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/sd.c?rev=35834&r1=35833&r2=35834&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/se/sd.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/se/sd.c [iso-8859-1] Sun Aug 31 10:29:21 2008
@@ -619,8 +619,9 @@
         
         /* allocate enough memory to store a complete copy of a self-relative
          security descriptor */
-        NewDescriptor = ExAllocatePool(PoolType,
-                                       DescriptorSize);
+        NewDescriptor = ExAllocatePoolWithTag(PoolType,
+                                              DescriptorSize,
+                                              TAG_SD);
         if(NewDescriptor != NULL)
         {
             ULONG_PTR Offset = sizeof(SECURITY_DESCRIPTOR);
@@ -872,7 +873,7 @@
         (CurrentMode == KernelMode && CaptureIfKernelMode)))
     {
         /* only delete the descriptor when SeCaptureSecurityDescriptor() allocated one! */
-        ExFreePool(CapturedSecurityDescriptor);
+        ExFreePoolWithTag(CapturedSecurityDescriptor, TAG_SD);
     }
     
     return STATUS_SUCCESS;
@@ -1450,8 +1451,9 @@
            DaclLength,
            SaclLength);
     
-    Descriptor = ExAllocatePool(PagedPool,
-                                Length);
+    Descriptor = ExAllocatePoolWithTag(PagedPool,
+                                       Length,
+                                       TAG_SD);
     if (Descriptor == NULL)
     {
         DPRINT1("ExAlloctePool() failed\n");



More information about the Ros-diffs mailing list