Previous Next

ExFreePoolWithTag

The ExFreePoolWithTag routine deallocates a block of pool memory allocated with the specified tag.

NTKERNELAPI
VOID
  ExFreePoolWithTag(
    IN PVOID  P,
    IN ULONG  Tag 
    ); 

Parameters

P
Specifies the beginning address of a block of pool memory allocated by either ExAllocatePoolWithTag or ExAllocatePoolWithQuotaTag.
Tag
Specifies the tag value passed to ExAllocatePoolWithTag or ExAllocatePoolWithQuotaTag when the block of memory was originally allocated.

Return Value

None

Headers

Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.

Comments

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.

See Also

ExAllocatePoolWithTag, ExAllocatePoolWithQuotaTag, ExFreePool