IMallocSpy::PreFree  1_NGK97

Called just before invoking IMalloc::Free62NW.NT 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

pRequest

[in] Pointer to the block of memory that the caller is passing to IMalloc::Free62NW.NT.

fSpyed

[in] TRUE if the pRequest parameter of IMallocSpy::PreFree was allocated while the spy was installed. This value is also passed to IMallocSpy::PostFree4250_PW.

 

Return Value

The actual pointer to pass to IMalloc::Free62NW.NT.

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