rpcrt4: Fix a memory leak in I_RpcSendReceive caused by I_RpcReceive overwriting pMsg->Buffer.

(Reported by Huw Davies.)
This commit is contained in:
Rob Shearman 2007-02-21 17:12:41 +00:00 committed by Alexandre Julliard
parent b491d926d5
commit ca6fe3fbf2

View File

@ -1030,10 +1030,16 @@ fail:
RPC_STATUS WINAPI I_RpcSendReceive(PRPC_MESSAGE pMsg)
{
RPC_STATUS status;
RPC_MESSAGE original_message;
TRACE("(%p)\n", pMsg);
original_message = *pMsg;
status = I_RpcSend(pMsg);
if (status == RPC_S_OK)
status = I_RpcReceive(pMsg);
/* free the buffer replaced by a new buffer in I_RpcReceive */
if (status == RPC_S_OK)
I_RpcFreeBuffer(&original_message);
return status;
}