Robert Shearman : rpcrt4: Don' t call IUnknown_AddRef if there is no outer unknown in

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 7 09:57:27 CST 2006


Module: wine
Branch: refs/heads/master
Commit: b7bf68f4d00d8e1c6239ad6ef5ce5244bfe4a29e
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=b7bf68f4d00d8e1c6239ad6ef5ce5244bfe4a29e

Author: Robert Shearman <rob at codeweavers.com>
Date:   Tue Feb  7 16:24:33 2006 +0100

rpcrt4: Don't call IUnknown_AddRef if there is no outer unknown in
StdProxy_Construct as it will just crash anyway.

---

 dlls/rpcrt4/cproxy.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/dlls/rpcrt4/cproxy.c b/dlls/rpcrt4/cproxy.c
index 21f23f3..f045e0c 100644
--- a/dlls/rpcrt4/cproxy.c
+++ b/dlls/rpcrt4/cproxy.c
@@ -188,7 +188,11 @@ HRESULT WINAPI StdProxy_Construct(REFIID
   This->pChannel = NULL;
   *ppProxy = (LPRPCPROXYBUFFER)&This->lpVtbl;
   *ppvObj = &This->PVtbl;
-  IUnknown_AddRef((IUnknown *)*ppvObj);
+  /* if there is no outer unknown then the caller will control the lifetime
+   * of the proxy object through the proxy buffer, so no need to increment the
+   * ref count of the proxy object */
+  if (pUnkOuter)
+    IUnknown_AddRef((IUnknown *)*ppvObj);
   IPSFactoryBuffer_AddRef(pPSFactory);
 
   return S_OK;




More information about the wine-cvs mailing list