From b7bf68f4d00d8e1c6239ad6ef5ce5244bfe4a29e Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Tue, 7 Feb 2006 16:24:33 +0100 Subject: [PATCH] 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 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/rpcrt4/cproxy.c b/dlls/rpcrt4/cproxy.c index 21f23f31734..f045e0c8e33 100644 --- a/dlls/rpcrt4/cproxy.c +++ b/dlls/rpcrt4/cproxy.c @@ -188,7 +188,11 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid, 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;