The ExFreePoolWithTag routine deallocates a block of pool memory allocated with the specified tag.
NTKERNELAPI
VOID
ExFreePoolWithTag(
IN PVOID P,
IN ULONG Tag
);
None
Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.
The ExFreePoolWithTag routine issues a bug check if the specified value for Tag does not match the tag value passed to the routine that originally allocated the memory block. Otherwise, the behavior of this routine is identical to ExFreePool.
When the tags fail to match, the routine issues a bug check with bug check code BAD_POOL_CALLER. The first argument is 0x0A. The second argument is the routine's P parameter. The third argument specifies the correct tag for the memory block. The fourth argument specifies the routine's Tag parameter. For more information about this bug check, see Bug Check 0xC2 (BAD_POOL_CALLER).
Callers of ExFreePoolWithTag must be running at IRQL <= DISPATCH_LEVEL. A caller at DISPATCH_LEVEL must have specified a NonPagedXxx PoolType when the memory was allocated. Otherwise, the caller must be running at IRQL < DISPATCH_LEVEL.
ExAllocatePoolWithTag, ExAllocatePoolWithQuotaTag, ExFreePool