Rob Shearman : rpcrt4: Don't set Buffer to NULL in I_RpcFreeBuffer.

Alexandre Julliard julliard at winehq.org
Mon Jan 7 08:39:05 CST 2008


Module: wine
Branch: master
Commit: 0e6d5202c889acec7a07237fb3c3f25305e07050
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0e6d5202c889acec7a07237fb3c3f25305e07050

Author: Rob Shearman <rob at codeweavers.com>
Date:   Fri Jan  4 17:37:59 2008 +0000

rpcrt4: Don't set Buffer to NULL in I_RpcFreeBuffer.

---

 dlls/rpcrt4/rpc_message.c        |   10 +++-------
 dlls/rpcrt4/tests/ndr_marshall.c |    1 -
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/dlls/rpcrt4/rpc_message.c b/dlls/rpcrt4/rpc_message.c
index 1248e46..9f0df05 100644
--- a/dlls/rpcrt4/rpc_message.c
+++ b/dlls/rpcrt4/rpc_message.c
@@ -917,12 +917,10 @@ fail:
 RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg)
 {
   TRACE("(%p): BufferLength=%d\n", pMsg, pMsg->BufferLength);
-  /* FIXME: pfnAllocate? */
   pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
 
   TRACE("Buffer=%p\n", pMsg->Buffer);
-  /* FIXME: which errors to return? */
-  return pMsg->Buffer ? S_OK : E_OUTOFMEMORY;
+  return pMsg->Buffer ? RPC_S_OK : ERROR_OUTOFMEMORY;
 }
 
 /***********************************************************************
@@ -934,7 +932,7 @@ static RPC_STATUS I_RpcReAllocateBuffer(PRPC_MESSAGE pMsg)
   pMsg->Buffer = HeapReAlloc(GetProcessHeap(), 0, pMsg->Buffer, pMsg->BufferLength);
 
   TRACE("Buffer=%p\n", pMsg->Buffer);
-  return pMsg->Buffer ? RPC_S_OK : RPC_S_OUT_OF_RESOURCES;
+  return pMsg->Buffer ? RPC_S_OK : ERROR_OUTOFMEMORY;
 }
 
 /***********************************************************************
@@ -955,10 +953,8 @@ static RPC_STATUS I_RpcReAllocateBuffer(PRPC_MESSAGE pMsg)
 RPC_STATUS WINAPI I_RpcFreeBuffer(PRPC_MESSAGE pMsg)
 {
   TRACE("(%p) Buffer=%p\n", pMsg, pMsg->Buffer);
-  /* FIXME: pfnFree? */
   HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
-  pMsg->Buffer = NULL;
-  return S_OK;
+  return RPC_S_OK;
 }
 
 /***********************************************************************
diff --git a/dlls/rpcrt4/tests/ndr_marshall.c b/dlls/rpcrt4/tests/ndr_marshall.c
index 86ec190..d02135b 100644
--- a/dlls/rpcrt4/tests/ndr_marshall.c
+++ b/dlls/rpcrt4/tests/ndr_marshall.c
@@ -1576,7 +1576,6 @@ todo_wine
     StubMsg.BufferLength = 1;
     NdrFreeBuffer(&StubMsg);
     ok(RpcMessage.Handle != NULL, "RpcMessage.Handle should not have been NULL\n");
-todo_wine
     ok(RpcMessage.Buffer != NULL, "RpcMessage.Buffer should not have been NULL\n");
     ok(RpcMessage.BufferLength == 10, "RpcMessage.BufferLength should have been left as 10 instead of %d\n", RpcMessage.BufferLength);
     ok(StubMsg.Buffer != NULL, "Buffer should not have been NULL\n");




More information about the wine-cvs mailing list