Rob Shearman : rpcrt4: Set the fBufferValid flag in NdrProxyGetBuffer.

Alexandre Julliard julliard at winehq.org
Tue Jan 8 10:21:47 CST 2008


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Tue Jan  8 12:02:55 2008 +0000

rpcrt4: Set the fBufferValid flag in NdrProxyGetBuffer.

Only call IRpcChannelBuffer_FreeBuffer in NdrProxyFreeBuffer if 
fBufferValid is set.

---

 dlls/rpcrt4/cproxy.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/rpcrt4/cproxy.c b/dlls/rpcrt4/cproxy.c
index 6580bcf..084285a 100644
--- a/dlls/rpcrt4/cproxy.c
+++ b/dlls/rpcrt4/cproxy.c
@@ -364,6 +364,7 @@ void WINAPI NdrProxyGetBuffer(void *This,
     RpcRaiseException(hr);
     return;
   }
+  pStubMsg->fBufferValid = TRUE;
   pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
   pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
   pStubMsg->Buffer = pStubMsg->BufferStart;
@@ -408,11 +409,14 @@ void WINAPI NdrProxySendReceive(void *This,
 void WINAPI NdrProxyFreeBuffer(void *This,
                               PMIDL_STUB_MESSAGE pStubMsg)
 {
-  HRESULT hr;
-
   TRACE("(%p,%p)\n", This, pStubMsg);
-  hr = IRpcChannelBuffer_FreeBuffer(pStubMsg->pRpcChannelBuffer,
-                                   (RPCOLEMESSAGE*)pStubMsg->RpcMsg);
+
+  if (pStubMsg->fBufferValid)
+  {
+    IRpcChannelBuffer_FreeBuffer(pStubMsg->pRpcChannelBuffer,
+                                 (RPCOLEMESSAGE*)pStubMsg->RpcMsg);
+    pStubMsg->fBufferValid = TRUE;
+  }
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list