Called just before invoking IMalloc::Free to ensure that the pointer passed to IMalloc::Free points to the beginning of the actual allocation.
void * PreFree(
void * pRequest, |
//Pointer is passing to IMalloc::Free |
BOOL fSpyed |
//TRUE if this memory was allocated while the spy was active |
); |
Parameters
Return Value
The actual pointer to pass to IMalloc::Free.
Remarks
If IMallocSpy::PreAlloc modified the original allocation request passed to IMalloc::Alloc (or IMalloc::Realloc), IMallocSpy::PreFree must supply a pointer to the actual allocation, which OLE will pass to IMalloc::Free. For example, if the PreAlloc/PostAlloc pair attached a header used to store debug information to the beginning of the caller’s allocation, PreFree must return a pointer to the beginning of this header, so all of the block that was allocated can be freed.
See Also
IMalloc::Free, IMallocSpy::PostFree, CoRegisterMallocSpy, CoRevokeMallocSpy