HRESULT IRpcChannelBuffer::FreeBuffer(pMessage)
Free a memory buffer in pMessage->pvBuffer that was previously allocated by the channel.
At various times the RPC channel allocates a memory buffer and returns control of same to a calling client. Both GetBuffer() and SendReceive() do so, for example. FreeBuffer() is the means by which said calling client informs the channel that it is done with the buffer.
On function entry, the buffer which is to be freed is pMessage->pvBuffer, which explicitly may or may not be NULL. If pMessage->pvBuffer is non-NULL, then FreeBuffer() frees the buffer, NULLs the pointer, and returns NOERROR; if pMessage->pvBuffer is NULL, then FreeBuffer() simply returns NOERROR (for example, passing NULL is not an error). Thus, on function exit, pMessage->pvBuffer is always NULL. Notice that pMessage->cbBuffer is never looked at or changed.
There are strict rules as to what data accessible from pMessage may have been modified in the intervening time between the time the buffer was allocated and the call to FreeBuffer(). In short, very little modification is permitted; see above and below for precise details.
Argument
Type
Description
pMessage
RPCOLEMESSAGE *
Pointer to structure containing pointer to buffer to free.