Don't free previous buffer in NdrGetBuffer.

This commit is contained in:
Robert Shearman 2005-08-03 14:55:05 +00:00 committed by Alexandre Julliard
parent f732617397
commit c9e4ef73d2
1 changed files with 2 additions and 11 deletions

View File

@ -447,19 +447,10 @@ fail:
*/ */
RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg) RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg)
{ {
RpcBinding* bind = (RpcBinding*)pMsg->Handle;
TRACE("(%p): BufferLength=%d\n", pMsg, pMsg->BufferLength); TRACE("(%p): BufferLength=%d\n", pMsg, pMsg->BufferLength);
/* FIXME: pfnAllocate? */ /* FIXME: pfnAllocate? */
if (bind->server) { pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
/* it turns out that the original buffer data must still be available
* while the RPC server is marshalling a reply, so we should not deallocate
* it, we'll leave deallocating the original buffer to the RPC server */
pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
} else {
HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
}
TRACE("Buffer=%p\n", pMsg->Buffer); TRACE("Buffer=%p\n", pMsg->Buffer);
/* FIXME: which errors to return? */ /* FIXME: which errors to return? */
return pMsg->Buffer ? S_OK : E_OUTOFMEMORY; return pMsg->Buffer ? S_OK : E_OUTOFMEMORY;