Replace some ExFreePool by ExFreePoolWithTag

svn path=/trunk/; revision=35834
This commit is contained in:
Hervé Poussineau 2008-08-31 15:29:21 +00:00
parent 56c56ab228
commit d2ba8bac96
24 changed files with 101 additions and 92 deletions

View file

@ -62,7 +62,7 @@ CmpFreeKeyControlBlock(IN PCM_KEY_CONTROL_BLOCK Kcb)
if (!Kcb->PrivateAlloc) if (!Kcb->PrivateAlloc)
{ {
/* Free it from the pool */ /* Free it from the pool */
ExFreePool(Kcb); ExFreePoolWithTag(Kcb, TAG_CM);
return; return;
} }
@ -99,7 +99,7 @@ CmpFreeKeyControlBlock(IN PCM_KEY_CONTROL_BLOCK Kcb)
} }
/* Free the page */ /* Free the page */
ExFreePool(AllocPage); ExFreePoolWithTag(AllocPage, TAG_CM);
} }
/* Release the lock */ /* Release the lock */
@ -296,7 +296,7 @@ CmpFreeDelayItem(PVOID Entry)
} }
/* Now free the page */ /* Now free the page */
ExFreePool(AllocPage); ExFreePoolWithTag(AllocPage, TAG_CM);
} }
/* Release the lock */ /* Release the lock */

View file

@ -386,7 +386,7 @@ CmpInitializeHardwareConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
} }
/* Close our handle, free the buffer and return status */ /* Close our handle, free the buffer and return status */
ExFreePool(CmpConfigurationData); ExFreePoolWithTag(CmpConfigurationData, TAG_CM);
NtClose(KeyHandle); NtClose(KeyHandle);
return Status; return Status;
} }

View file

@ -129,8 +129,8 @@ CmpHiveRootSecurityDescriptor(VOID)
if (!NT_SUCCESS(Status)) KeBugCheckEx(REGISTRY_ERROR, 11, 8, Status, 0); if (!NT_SUCCESS(Status)) KeBugCheckEx(REGISTRY_ERROR, 11, 8, Status, 0);
/* Free the SIDs and original ACL */ /* Free the SIDs and original ACL */
for (i = 0; i < 4; i++) ExFreePool(Sid[i]); for (i = 0; i < 4; i++) ExFreePoolWithTag(Sid[i], TAG_CM);
ExFreePool(Acl); ExFreePoolWithTag(Acl, TAG_CM);
/* Return the security descriptor */ /* Return the security descriptor */
return SecurityDescriptor; return SecurityDescriptor;

View file

@ -804,7 +804,7 @@ CmpInitializeSystemHive(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
SecurityDescriptor); SecurityDescriptor);
/* Free the security descriptor */ /* Free the security descriptor */
ExFreePool(SecurityDescriptor); ExFreePoolWithTag(SecurityDescriptor, TAG_CM);
if (!NT_SUCCESS(Status)) return FALSE; if (!NT_SUCCESS(Status)) return FALSE;
/* Add the hive to the hive list */ /* Add the hive to the hive list */
@ -944,7 +944,7 @@ CmpCreateRegistryRoot(VOID)
0, 0,
0, 0,
(PVOID*)&RootKey); (PVOID*)&RootKey);
ExFreePool(SecurityDescriptor); ExFreePoolWithTag(SecurityDescriptor, TAG_CM);
if (!NT_SUCCESS(Status)) return FALSE; if (!NT_SUCCESS(Status)) return FALSE;
/* Sanity check, and get the key cell */ /* Sanity check, and get the key cell */
@ -1041,7 +1041,7 @@ CmpGetRegistryPath(IN PWCHAR ConfigPath)
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* Fail */ /* Fail */
ExFreePool(ValueInfo); ExFreePoolWithTag(ValueInfo, TAG_CM);
return Status; return Status;
} }
@ -1050,7 +1050,7 @@ CmpGetRegistryPath(IN PWCHAR ConfigPath)
ValueInfo->Data, ValueInfo->Data,
ValueInfo->DataLength); ValueInfo->DataLength);
ConfigPath[ValueInfo->DataLength / sizeof(WCHAR)] = UNICODE_NULL; ConfigPath[ValueInfo->DataLength / sizeof(WCHAR)] = UNICODE_NULL;
ExFreePool(ValueInfo); ExFreePoolWithTag(ValueInfo, TAG_CM);
} }
else else
{ {
@ -1356,7 +1356,7 @@ CmpInitializeHiveList(IN USHORT Flag)
} }
/* Get rid of the SD */ /* Get rid of the SD */
ExFreePool(SecurityDescriptor); ExFreePoolWithTag(SecurityDescriptor, TAG_CM);
/* FIXME: Link SECURITY to SAM */ /* FIXME: Link SECURITY to SAM */
@ -1541,7 +1541,7 @@ CmInitSystem1(VOID)
/* FIXME: Add to HiveList key */ /* FIXME: Add to HiveList key */
/* Free the security descriptor */ /* Free the security descriptor */
ExFreePool(SecurityDescriptor); ExFreePoolWithTag(SecurityDescriptor, TAG_CM);
/* Fill out the Hardware key with the ARC Data from the Loader */ /* Fill out the Hardware key with the ARC Data from the Loader */
Status = CmpInitializeHardwareConfiguration(KeLoaderBlock); Status = CmpInitializeHardwareConfiguration(KeLoaderBlock);
@ -1568,7 +1568,7 @@ CmInitSystem1(VOID)
} }
/* Free the load options */ /* Free the load options */
ExFreePool(CmpLoadOptions.Buffer); ExFreePoolWithTag(CmpLoadOptions.Buffer, TAG_CM);
/* If we got here, all went well */ /* If we got here, all went well */
return TRUE; return TRUE;

View file

@ -546,7 +546,7 @@ CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBloc
} }
/* Free the configuration data */ /* Free the configuration data */
ExFreePool(CmpConfigurationData); ExFreePoolWithTag(CmpConfigurationData, TAG_CM);
} }
/* Open physical memory */ /* Open physical memory */
@ -824,7 +824,7 @@ CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBloc
ZwClose(SectionHandle); ZwClose(SectionHandle);
/* Free the BIOS version string buffer */ /* Free the BIOS version string buffer */
if (BiosVersion) ExFreePool(BiosVersion); if (BiosVersion) ExFreePoolWithTag(BiosVersion, TAG_CM);
Quickie: Quickie:
/* Close the procesor handle */ /* Close the procesor handle */

View file

@ -324,7 +324,7 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
RtlCopyMemory(SectionBase, ExpNlsTableBase, ExpNlsTableSize); RtlCopyMemory(SectionBase, ExpNlsTableBase, ExpNlsTableSize);
/* Free the previously allocated buffer and set the new location */ /* Free the previously allocated buffer and set the new location */
ExFreePool(ExpNlsTableBase); ExFreePoolWithTag(ExpNlsTableBase, TAG('R', 't', 'l', 'i'));
ExpNlsTableBase = SectionBase; ExpNlsTableBase = SectionBase;
/* Initialize the NLS Tables */ /* Initialize the NLS Tables */

View file

@ -948,7 +948,7 @@ HalpGetFullGeometry(IN PDEVICE_OBJECT DeviceObject,
if (!Irp) if (!Irp)
{ {
/* Fail, free the event */ /* Fail, free the event */
ExFreePool(Event); ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
} }
@ -977,7 +977,7 @@ HalpGetFullGeometry(IN PDEVICE_OBJECT DeviceObject,
if (!Irp) if (!Irp)
{ {
/* Fail, free the event */ /* Fail, free the event */
ExFreePool(Event); ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
} }
@ -1000,7 +1000,7 @@ HalpGetFullGeometry(IN PDEVICE_OBJECT DeviceObject,
} }
/* Free the event and return the Status */ /* Free the event and return the Status */
ExFreePool(Event); ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
return Status; return Status;
} }
@ -1200,7 +1200,7 @@ xHalGetPartialGeometry(IN PDEVICE_OBJECT DeviceObject,
Cleanup: Cleanup:
/* Free all the pointers */ /* Free all the pointers */
if (Event) ExFreePool(Event); if (Event) ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
if (IoStatusBlock) ExFreePool(IoStatusBlock); if (IoStatusBlock) ExFreePool(IoStatusBlock);
if (DiskGeometry) ExFreePool(DiskGeometry); if (DiskGeometry) ExFreePool(DiskGeometry);
return; return;
@ -1251,7 +1251,7 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
if (!Irp) if (!Irp)
{ {
/* Failed */ /* Failed */
ExFreePool(Buffer); ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
return; return;
} }
@ -1275,7 +1275,7 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
if (((PUSHORT)Buffer)[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE) if (((PUSHORT)Buffer)[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE)
{ {
/* Failed */ /* Failed */
ExFreePool(Buffer); ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
return; return;
} }
@ -1287,7 +1287,7 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject,
if (PartitionDescriptor->PartitionType != MbrTypeIdentifier) if (PartitionDescriptor->PartitionType != MbrTypeIdentifier)
{ {
/* It's not, free our buffer */ /* It's not, free our buffer */
ExFreePool(Buffer); ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
} }
else else
{ {
@ -1367,7 +1367,7 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
Status = HalpGetFullGeometry(DeviceObject, &DiskGeometry, &MaxOffset); Status = HalpGetFullGeometry(DeviceObject, &DiskGeometry, &MaxOffset);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ExFreePool(*PartitionBuffer); ExFreePoolWithTag(*PartitionBuffer, TAG_FILE_SYSTEM);
*PartitionBuffer = NULL; *PartitionBuffer = NULL;
return Status; return Status;
} }
@ -1383,7 +1383,8 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
if (!Buffer) if (!Buffer)
{ {
/* Fail, free the input buffer */ /* Fail, free the input buffer */
ExFreePool(*PartitionBuffer); ExFreePoolWithTag(*PartitionBuffer, TAG_FILE_SYSTEM);
*PartitionBuffer = NULL;
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
} }
@ -1549,7 +1550,7 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
BufferSize); BufferSize);
/* Free the old buffer and set this one as the new one */ /* Free the old buffer and set this one as the new one */
ExFreePool(*PartitionBuffer); ExFreePoolWithTag(*PartitionBuffer, TAG_FILE_SYSTEM);
*PartitionBuffer = DriveLayoutInfo; *PartitionBuffer = DriveLayoutInfo;
/* Double the size */ /* Double the size */
@ -1732,8 +1733,8 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
if (!i) (*PartitionBuffer)->Signature = 0; if (!i) (*PartitionBuffer)->Signature = 0;
/* Free the buffer and check for success */ /* Free the buffer and check for success */
if (Buffer) ExFreePool(Buffer); if (Buffer) ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
if (!NT_SUCCESS(Status)) ExFreePool(*PartitionBuffer); if (!NT_SUCCESS(Status)) ExFreePoolWithTag(*PartitionBuffer, TAG_FILE_SYSTEM);
/* Return status */ /* Return status */
return Status; return Status;
@ -2212,7 +2213,7 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
} }
/* If we had a buffer, free it, then return status */ /* If we had a buffer, free it, then return status */
if (Buffer) ExFreePool(Buffer); if (Buffer) ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
return Status; return Status;
} }

View file

@ -242,8 +242,8 @@ IopGetDiskInformation(IN ULONG i,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* Try again */ /* Try again */
ExFreePool(PartitionBuffer); ExFreePoolWithTag(PartitionBuffer, TAG_IO);
ExFreePool(DriveLayout); ExFreePoolWithTag(DriveLayout, TAG_FILE_SYSTEM);
return FALSE; return FALSE;
} }
@ -257,8 +257,8 @@ IopGetDiskInformation(IN ULONG i,
*PartitionCount = DriveLayout->PartitionCount; *PartitionCount = DriveLayout->PartitionCount;
/* Free the buffer */ /* Free the buffer */
ExFreePool(PartitionBuffer); ExFreePoolWithTag(PartitionBuffer, TAG_IO);
ExFreePool(DriveLayout); ExFreePoolWithTag(DriveLayout, TAG_FILE_SYSTEM);
return TRUE; return TRUE;
} }
@ -574,7 +574,7 @@ IopCreateArcNames(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
} }
/* Free the buffer */ /* Free the buffer */
ExFreePool(PartitionBuffer); ExFreePoolWithTag(PartitionBuffer, TAG_IO);
} }
/* Return success */ /* Return success */

View file

@ -122,7 +122,7 @@ IoShutdownRegisteredDevices(VOID)
} }
/* Free the shutdown entry and reset the event */ /* Free the shutdown entry and reset the event */
ExFreePool(ShutdownEntry); ExFreePoolWithTag(ShutdownEntry, TAG_SHUTDOWN_ENTRY);
KeClearEvent(&Event); KeClearEvent(&Event);
/* Go to the next entry */ /* Go to the next entry */
@ -317,7 +317,7 @@ IopUnloadDevice(IN PDEVICE_OBJECT DeviceObject)
if (DeviceObject->SecurityDescriptor) if (DeviceObject->SecurityDescriptor)
{ {
/* Free it */ /* Free it */
ExFreePool(DeviceObject->SecurityDescriptor); ExFreePoolWithTag(DeviceObject->SecurityDescriptor, TAG_SD);
} }
/* Remove the device from the list */ /* Remove the device from the list */
@ -1328,7 +1328,7 @@ IoUnregisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
NextEntry = NextEntry->Blink; NextEntry = NextEntry->Blink;
/* Free the entry */ /* Free the entry */
ExFreePool(ShutdownEntry); ExFreePoolWithTag(ShutdownEntry, TAG_SHUTDOWN_ENTRY);
} }
/* Go to the next entry */ /* Go to the next entry */
@ -1352,7 +1352,7 @@ IoUnregisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
NextEntry = NextEntry->Blink; NextEntry = NextEntry->Blink;
/* Free the entry */ /* Free the entry */
ExFreePool(ShutdownEntry); ExFreePoolWithTag(ShutdownEntry, TAG_SHUTDOWN_ENTRY);
} }
/* Go to the next entry */ /* Go to the next entry */

View file

@ -29,6 +29,8 @@ UNICODE_STRING IopHardwareDatabaseKey =
POBJECT_TYPE IoDriverObjectType = NULL; POBJECT_TYPE IoDriverObjectType = NULL;
#define TAG_RTLREGISTRY TAG('R', 'q', 'r', 'v')
extern BOOLEAN ExpInTextModeSetup; extern BOOLEAN ExpInTextModeSetup;
/* PRIVATE FUNCTIONS **********************************************************/ /* PRIVATE FUNCTIONS **********************************************************/
@ -246,7 +248,7 @@ IopNormalizeImagePath(
RtlAppendUnicodeStringToString(ImagePath, &InputImagePath); RtlAppendUnicodeStringToString(ImagePath, &InputImagePath);
/* Free caller's string */ /* Free caller's string */
RtlFreeUnicodeString(&InputImagePath); ExFreePoolWithTag(InputImagePath.Buffer, TAG_RTLREGISTRY);
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;

View file

@ -37,6 +37,8 @@ typedef struct _SERVICE
/* BOOLEAN ServiceRunning;*/ // needed ?? /* BOOLEAN ServiceRunning;*/ // needed ??
} SERVICE, *PSERVICE; } SERVICE, *PSERVICE;
#define TAG_RTLREGISTRY TAG('R', 'q', 'r', 'v')
/* GLOBALS ********************************************************************/ /* GLOBALS ********************************************************************/
LIST_ENTRY GroupListHead = {NULL, NULL}; LIST_ENTRY GroupListHead = {NULL, NULL};
@ -205,11 +207,11 @@ IopCreateServiceListEntry(PUNICODE_STRING ServiceName)
*/ */
if (Service->ServiceGroup.Buffer) if (Service->ServiceGroup.Buffer)
{ {
ExFreePool(Service->ServiceGroup.Buffer); ExFreePoolWithTag(Service->ServiceGroup.Buffer, TAG_RTLREGISTRY);
} }
if (Service->ImagePath.Buffer) if (Service->ImagePath.Buffer)
{ {
ExFreePool(Service->ImagePath.Buffer); ExFreePoolWithTag(Service->ImagePath.Buffer, TAG_RTLREGISTRY);
} }
ExFreePool(Service); ExFreePool(Service);
return(Status); return(Status);

View file

@ -1031,7 +1031,7 @@ IopDeleteFile(IN PVOID ObjectBody)
/* Clear the file name */ /* Clear the file name */
if (FileObject->FileName.Buffer) if (FileObject->FileName.Buffer)
{ {
ExFreePool(FileObject->FileName.Buffer); ExFreePoolWithTag(FileObject->FileName.Buffer, TAG_IO_NAME);
FileObject->FileName.Buffer = NULL; FileObject->FileName.Buffer = NULL;
} }

View file

@ -1890,7 +1890,7 @@ NtQueryInformationFile(IN HANDLE FileHandle,
{ {
/* Clear it in the IRP for completion */ /* Clear it in the IRP for completion */
Irp->UserEvent = NULL; Irp->UserEvent = NULL;
ExFreePool(Event); ExFreePoolWithTag(Event, TAG_IO);
} }
/* Set the caller IOSB */ /* Set the caller IOSB */

View file

@ -179,7 +179,7 @@ IopQueryDeviceDescription(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
if (ControllerFullInformation != NULL) if (ControllerFullInformation != NULL)
ExFreePool(ControllerFullInformation); ExFreePoolWithTag(ControllerFullInformation, TAG_IO_RESOURCE);
return Status; return Status;
} }
@ -188,7 +188,7 @@ IopQueryDeviceDescription(
MaximumControllerNumber = ControllerFullInformation->SubKeys; MaximumControllerNumber = ControllerFullInformation->SubKeys;
/* Free Memory */ /* Free Memory */
ExFreePool(ControllerFullInformation); ExFreePoolWithTag(ControllerFullInformation, TAG_IO_RESOURCE);
ControllerFullInformation = NULL; ControllerFullInformation = NULL;
} }
@ -318,7 +318,7 @@ IopQueryDeviceDescription(
MaximumPeripheralNumber = PeripheralFullInformation->SubKeys; MaximumPeripheralNumber = PeripheralFullInformation->SubKeys;
/* Free Memory */ /* Free Memory */
ExFreePool(PeripheralFullInformation); ExFreePoolWithTag(PeripheralFullInformation, TAG_IO_RESOURCE);
PeripheralFullInformation = NULL; PeripheralFullInformation = NULL;
} }
@ -400,7 +400,7 @@ IopQueryDeviceDescription(
{ {
if (PeripheralInformation[PeripheralLoop]) if (PeripheralInformation[PeripheralLoop])
{ {
ExFreePool(PeripheralInformation[PeripheralLoop]); ExFreePoolWithTag(PeripheralInformation[PeripheralLoop], TAG_IO_RESOURCE);
PeripheralInformation[PeripheralLoop] = NULL; PeripheralInformation[PeripheralLoop] = NULL;
} }
} }
@ -416,7 +416,7 @@ EndLoop:
{ {
if (ControllerInformation[ControllerLoop]) if (ControllerInformation[ControllerLoop])
{ {
ExFreePool(ControllerInformation[ControllerLoop]); ExFreePoolWithTag(ControllerInformation[ControllerLoop], TAG_IO_RESOURCE);
ControllerInformation[ControllerLoop] = NULL; ControllerInformation[ControllerLoop] = NULL;
} }
} }
@ -498,7 +498,7 @@ IopQueryBusDescription(
} }
/* Deallocate the old Buffer */ /* Deallocate the old Buffer */
ExFreePool(FullInformation); ExFreePoolWithTag(FullInformation, TAG_IO_RESOURCE);
/* Try to find a Bus */ /* Try to find a Bus */
for (BusLoop = 0; NT_SUCCESS(Status); BusLoop++) for (BusLoop = 0; NT_SUCCESS(Status); BusLoop++)
@ -619,7 +619,7 @@ IopQueryBusDescription(
{ {
if (BusInformation[SubBusLoop]) if (BusInformation[SubBusLoop])
{ {
ExFreePool(BusInformation[SubBusLoop]); ExFreePoolWithTag(BusInformation[SubBusLoop], TAG_IO_RESOURCE);
BusInformation[SubBusLoop] = NULL; BusInformation[SubBusLoop] = NULL;
} }
} }
@ -645,7 +645,7 @@ IopQueryBusDescription(
/* Free the last remaining Allocated Memory */ /* Free the last remaining Allocated Memory */
if (BasicInformation) if (BasicInformation)
ExFreePool(BasicInformation); ExFreePoolWithTag(BasicInformation, TAG_IO_RESOURCE);
return Status; return Status;
} }
@ -788,7 +788,7 @@ IoQueryDeviceDescription(PINTERFACE_TYPE BusType OPTIONAL,
} }
/* Free Memory */ /* Free Memory */
ExFreePool(RootRegKey.Buffer); ExFreePoolWithTag(RootRegKey.Buffer, TAG_IO_RESOURCE);
return Status; return Status;
} }

View file

@ -1499,7 +1499,7 @@ IoFreeIrp(IN PIRP Irp)
if (!(Irp->AllocationFlags & IRP_ALLOCATED_FIXED_SIZE)) if (!(Irp->AllocationFlags & IRP_ALLOCATED_FIXED_SIZE))
{ {
/* Free it */ /* Free it */
ExFreePool(Irp); ExFreePoolWithTag(Irp, TAG_IRP);
} }
else else
{ {
@ -1528,7 +1528,7 @@ IoFreeIrp(IN PIRP Irp)
{ {
/* All lists failed, use the pool */ /* All lists failed, use the pool */
List->L.FreeMisses++; List->L.FreeMisses++;
ExFreePool(Irp); ExFreePoolWithTag(Irp, TAG_IRP);
Irp = NULL; Irp = NULL;
} }
} }

View file

@ -136,7 +136,7 @@ MmGetFileNameForSection(IN PROS_SECTION_OBJECT Section,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* Failed, free memory */ /* Failed, free memory */
ExFreePool(ObjectNameInfo); ExFreePoolWithTag(ObjectNameInfo, TAG('M', 'm', ' ', ' '));
return Status; return Status;
} }
@ -2759,7 +2759,7 @@ ExeFmtpReadFile(IN PVOID File,
} }
else else
{ {
ExFreePool(Buffer); ExFreePoolWithTag(Buffer, TAG('M', 'm', 'X', 'r'));
} }
return Status; return Status;
@ -3168,7 +3168,7 @@ ExeFmtpCreateImageSection(HANDLE FileHandle,
break; break;
} }
ExFreePool(FileHeaderBuffer); ExFreePoolWithTag(FileHeaderBuffer, TAG('M', 'm', 'X', 'r'));
/* /*
* No loader handled the format * No loader handled the format
@ -3963,7 +3963,7 @@ MmUnmapViewOfSegment(PMM_AVL_TABLE AddressSpace,
{ {
CurrentEntry = RemoveHeadList(RegionListHead); CurrentEntry = RemoveHeadList(RegionListHead);
CurrentRegion = CONTAINING_RECORD(CurrentEntry, MM_REGION, RegionListEntry); CurrentRegion = CONTAINING_RECORD(CurrentEntry, MM_REGION, RegionListEntry);
ExFreePool(CurrentRegion); ExFreePoolWithTag(CurrentRegion, TAG_MM_REGION);
} }
if (Section->AllocationAttributes & SEC_PHYSICALMEMORY) if (Section->AllocationAttributes & SEC_PHYSICALMEMORY)

View file

@ -660,7 +660,7 @@ MiSnapThunk(IN PVOID DllBase,
&MissingForwarder); &MissingForwarder);
/* Free the forwarder name and set the thunk */ /* Free the forwarder name and set the thunk */
ExFreePool(ForwardName); ExFreePoolWithTag(ForwardName, TAG_LDR_WSTR);
Address->u1 = ForwardThunk.u1; Address->u1 = ForwardThunk.u1;
break; break;
} }
@ -876,7 +876,7 @@ MiResolveImageReferences(IN PVOID ImageBase,
{ {
/* Failed */ /* Failed */
MiDereferenceImports(LoadedImports); MiDereferenceImports(LoadedImports);
if (LoadedImports) ExFreePool(LoadedImports); if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
return Status; return Status;
} }
@ -997,7 +997,7 @@ CheckDllState:
/* Cleanup and return */ /* Cleanup and return */
RtlFreeUnicodeString(&NameString); RtlFreeUnicodeString(&NameString);
MiDereferenceImports(LoadedImports); MiDereferenceImports(LoadedImports);
if (LoadedImports) ExFreePool(LoadedImports); if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
return Status; return Status;
} }
@ -1030,7 +1030,7 @@ CheckDllState:
{ {
/* Cleanup and return */ /* Cleanup and return */
MiDereferenceImports(LoadedImports); MiDereferenceImports(LoadedImports);
if (LoadedImports) ExFreePool(LoadedImports); if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
return STATUS_DRIVER_ENTRYPOINT_NOT_FOUND; return STATUS_DRIVER_ENTRYPOINT_NOT_FOUND;
} }
@ -1059,7 +1059,7 @@ CheckDllState:
{ {
/* Cleanup and return */ /* Cleanup and return */
MiDereferenceImports(LoadedImports); MiDereferenceImports(LoadedImports);
if (LoadedImports) ExFreePool(LoadedImports); if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
return Status; return Status;
} }
@ -1091,13 +1091,13 @@ CheckDllState:
if (!ImportCount) if (!ImportCount)
{ {
/* Free the list and set it to no imports */ /* Free the list and set it to no imports */
ExFreePool(LoadedImports); ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
LoadedImports = (PVOID)-2; LoadedImports = (PVOID)-2;
} }
else if (ImportCount == 1) else if (ImportCount == 1)
{ {
/* Just one entry, we can free the table and only use our entry */ /* Just one entry, we can free the table and only use our entry */
ExFreePool(LoadedImports); ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
LoadedImports = (PLOAD_IMPORTS)ImportEntry; LoadedImports = (PLOAD_IMPORTS)ImportEntry;
} }
else if (ImportCount != LoadedImports->Count) else if (ImportCount != LoadedImports->Count)
@ -1125,7 +1125,7 @@ CheckDllState:
} }
/* Free the old copy */ /* Free the old copy */
ExFreePool(LoadedImports); ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);
LoadedImports = NewImports; LoadedImports = NewImports;
} }
} }
@ -1834,7 +1834,7 @@ LoaderScan:
} }
/* Free the entry itself */ /* Free the entry itself */
ExFreePool(LdrEntry); ExFreePoolWithTag(LdrEntry, TAG_MODULE_OBJECT);
LdrEntry = NULL; LdrEntry = NULL;
goto Quickie; goto Quickie;
} }
@ -1924,7 +1924,7 @@ Quickie:
if (NamePrefix) ExFreePool(PrefixName.Buffer); if (NamePrefix) ExFreePool(PrefixName.Buffer);
/* Free the name buffer and return status */ /* Free the name buffer and return status */
ExFreePool(Buffer); ExFreePoolWithTag(Buffer, TAG_LDR_WSTR);
return Status; return Status;
} }

View file

@ -326,7 +326,7 @@ ObpDeleteEntryDirectory(POBP_LOOKUP_CONTEXT Context)
CurrentEntry->ChainLink = NULL; CurrentEntry->ChainLink = NULL;
/* Free it */ /* Free it */
ExFreePool(CurrentEntry); ExFreePoolWithTag(CurrentEntry, OB_DIR_TAG);
/* Return */ /* Return */
return TRUE; return TRUE;
@ -529,7 +529,7 @@ NtQueryDirectoryObject(IN HANDLE DirectoryHandle,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* Free the buffer and fail */ /* Free the buffer and fail */
ExFreePool(LocalBuffer); ExFreePoolWithTag(LocalBuffer, OB_NAME_TAG);
return Status; return Status;
} }
@ -701,7 +701,7 @@ Quickie:
/* Dereference the directory and free our buffer */ /* Dereference the directory and free our buffer */
ObDereferenceObject(Directory); ObDereferenceObject(Directory);
ExFreePool(LocalBuffer); ExFreePoolWithTag(LocalBuffer, OB_NAME_TAG);
/* Return status to caller */ /* Return status to caller */
return Status; return Status;

View file

@ -289,7 +289,7 @@ ObpInsertHandleCount(IN POBJECT_HEADER ObjectHeader)
else else
{ {
/* Otherwise we had a DB, free it */ /* 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 */ /* Find the end of the copy and zero out the new data */
@ -2425,7 +2425,7 @@ ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* Fail */ /* Fail */
ExFreePool(TempBuffer); ExFreePoolWithTag(TempBuffer, TAG_OB_TEMP_STORAGE);
return Status; return Status;
} }
@ -2533,7 +2533,7 @@ Quickie:
/* Release the object attributes and temporary buffer */ /* Release the object attributes and temporary buffer */
ObpReleaseObjectCreateInformation(&TempBuffer->ObjectCreateInfo); ObpReleaseObjectCreateInformation(&TempBuffer->ObjectCreateInfo);
if (ObjectName.Buffer) ObpFreeObjectNameBuffer(&ObjectName); if (ObjectName.Buffer) ObpFreeObjectNameBuffer(&ObjectName);
ExFreePool(TempBuffer); ExFreePoolWithTag(TempBuffer, TAG_OB_TEMP_STORAGE);
/* Return status */ /* Return status */
OBTRACE(OB_HANDLE_DEBUG, OBTRACE(OB_HANDLE_DEBUG,

View file

@ -720,7 +720,7 @@ ParseFromRoot:
if (ObjectNameInfo->Name.Buffer) if (ObjectNameInfo->Name.Buffer)
{ {
/* Free it */ /* Free it */
ExFreePool(ObjectNameInfo->Name.Buffer); ExFreePoolWithTag(ObjectNameInfo->Name.Buffer, OB_NAME_TAG );
} }
/* Write new one */ /* Write new one */

View file

@ -40,7 +40,7 @@ ObAssignObjectSecurityDescriptor(IN PVOID Object,
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
/* Free the old copy */ /* Free the old copy */
ExFreePool(SecurityDescriptor); ExFreePoolWithTag(SecurityDescriptor, TAG_SD);
/* Set the new pointer */ /* Set the new pointer */
ASSERT(NewSd); ASSERT(NewSd);
@ -633,7 +633,7 @@ ObGetObjectSecurity(IN PVOID Object,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* Free the descriptor and tell the caller we failed */ /* Free the descriptor and tell the caller we failed */
ExFreePool(*SecurityDescriptor); ExFreePoolWithTag(*SecurityDescriptor, TAG_SEC_QUERY);
*MemoryAllocated = FALSE; *MemoryAllocated = FALSE;
} }

View file

@ -279,7 +279,7 @@ Quickie:
} }
/* Free wait block array */ /* Free wait block array */
if (WaitBlockArray) ExFreePool(WaitBlockArray); if (WaitBlockArray) ExFreePoolWithTag(WaitBlockArray, TAG_WAIT);
/* Re-enable APCs if needed */ /* Re-enable APCs if needed */
if (LockInUse) KeLeaveCriticalRegion(); if (LockInUse) KeLeaveCriticalRegion();

View file

@ -13,6 +13,8 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
#define TAG_ATMT TAG('A', 't', 'o', 'T') /* Atom table */
extern ULONG NtGlobalFlag; extern ULONG NtGlobalFlag;
typedef struct _RTL_RANGE_ENTRY typedef struct _RTL_RANGE_ENTRY
@ -482,12 +484,12 @@ RtlpFreeAtomTable(PRTL_ATOM_TABLE AtomTable)
PRTL_ATOM_TABLE_ENTRY PRTL_ATOM_TABLE_ENTRY
RtlpAllocAtomTableEntry(ULONG Size) RtlpAllocAtomTableEntry(ULONG Size)
{ {
PRTL_ATOM_TABLE_ENTRY Entry = ExAllocatePool(NonPagedPool, PRTL_ATOM_TABLE_ENTRY Entry;
Size);
Entry = ExAllocatePoolWithTag(NonPagedPool, Size, TAG_ATMT);
if (Entry != NULL) if (Entry != NULL)
{ {
RtlZeroMemory(Entry, RtlZeroMemory(Entry, Size);
Size);
} }
return Entry; return Entry;
@ -496,7 +498,7 @@ RtlpAllocAtomTableEntry(ULONG Size)
VOID VOID
RtlpFreeAtomTableEntry(PRTL_ATOM_TABLE_ENTRY Entry) RtlpFreeAtomTableEntry(PRTL_ATOM_TABLE_ENTRY Entry)
{ {
ExFreePool(Entry); ExFreePoolWithTag(Entry, TAG_ATMT);
} }
VOID VOID

View file

@ -619,8 +619,9 @@ DescriptorCopy.AclType = NULL; \
/* allocate enough memory to store a complete copy of a self-relative /* allocate enough memory to store a complete copy of a self-relative
security descriptor */ security descriptor */
NewDescriptor = ExAllocatePool(PoolType, NewDescriptor = ExAllocatePoolWithTag(PoolType,
DescriptorSize); DescriptorSize,
TAG_SD);
if(NewDescriptor != NULL) if(NewDescriptor != NULL)
{ {
ULONG_PTR Offset = sizeof(SECURITY_DESCRIPTOR); ULONG_PTR Offset = sizeof(SECURITY_DESCRIPTOR);
@ -872,7 +873,7 @@ SeReleaseSecurityDescriptor(IN PSECURITY_DESCRIPTOR CapturedSecurityDescriptor,
(CurrentMode == KernelMode && CaptureIfKernelMode))) (CurrentMode == KernelMode && CaptureIfKernelMode)))
{ {
/* only delete the descriptor when SeCaptureSecurityDescriptor() allocated one! */ /* only delete the descriptor when SeCaptureSecurityDescriptor() allocated one! */
ExFreePool(CapturedSecurityDescriptor); ExFreePoolWithTag(CapturedSecurityDescriptor, TAG_SD);
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
@ -1450,8 +1451,9 @@ SeAssignSecurity(PSECURITY_DESCRIPTOR _ParentDescriptor OPTIONAL,
DaclLength, DaclLength,
SaclLength); SaclLength);
Descriptor = ExAllocatePool(PagedPool, Descriptor = ExAllocatePoolWithTag(PagedPool,
Length); Length,
TAG_SD);
if (Descriptor == NULL) if (Descriptor == NULL)
{ {
DPRINT1("ExAlloctePool() failed\n"); DPRINT1("ExAlloctePool() failed\n");