ole32: Release the proxy buffer object on the last release of the proxy's outer unknown.

Release the proxy buffer object on the last release of the proxy's outer
unknown, otherwise memory is leaked for the Ndr implementation of
IRpcProxyBuffer.

Fix up the hand-coded proxies to match the behaviour from the Ndr
implementation.
This commit is contained in:
Robert Shearman 2006-05-22 22:17:13 +01:00 committed by Alexandre Julliard
parent d4245634ca
commit 875390110f
2 changed files with 9 additions and 23 deletions

View File

@ -543,9 +543,7 @@ static void ifproxy_destroy(struct ifproxy * This)
This->chan = NULL;
}
/* note: we don't call Release for This->proxy because its lifetime is
* controlled by the return value from ClientIdentity_Release, which this
* function is always called from */
if (This->proxy) IRpcProxyBuffer_Release(This->proxy);
HeapFree(GetProcessHeap(), 0, This);
}

View File

@ -66,6 +66,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
const CLSID CLSID_DfMarshal = { 0x0000030b, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46} };
const CLSID CLSID_PSFactoryBuffer = { 0x00000320, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46} };
static ULONG WINAPI RURpcProxyBufferImpl_Release(LPRPCPROXYBUFFER iface);
/* From: http://msdn.microsoft.com/library/en-us/com/cmi_m_4lda.asp
*
* The first time a client requests a pointer to an interface on a
@ -345,18 +347,11 @@ static ULONG WINAPI CFProxy_AddRef(LPCLASSFACTORY iface) {
}
static ULONG WINAPI CFProxy_Release(LPCLASSFACTORY iface) {
ULONG ref;
ICOM_THIS_MULTI(CFProxy,lpvtbl_cf,iface);
if (This->outer_unknown)
ref = IUnknown_Release(This->outer_unknown);
else
ref = InterlockedDecrement(&This->ref);
if (!ref) {
if (This->chanbuf) IRpcChannelBuffer_Release(This->chanbuf);
HeapFree(GetProcessHeap(),0,This);
}
return ref;
return IUnknown_Release(This->outer_unknown);
else
return IRpcProxyBufferImpl_Release((IRpcProxyBuffer *)&This->lpvtbl_proxy);
}
static HRESULT WINAPI CFProxy_CreateInstance(
@ -712,19 +707,12 @@ static ULONG WINAPI RemUnkProxy_AddRef(LPREMUNKNOWN iface)
static ULONG WINAPI RemUnkProxy_Release(LPREMUNKNOWN iface)
{
RemUnkProxy *This = (RemUnkProxy *)iface;
ULONG refs;
TRACE("(%p)->Release()\n",This);
if (This->outer_unknown)
refs = IUnknown_Release(This->outer_unknown);
else
refs = InterlockedDecrement(&This->refs);
if (!refs) {
if (This->chan) IRpcChannelBuffer_Release(This->chan);
HeapFree(GetProcessHeap(),0,This);
}
return refs;
return IUnknown_Release(This->outer_unknown);
else
return IRpcProxyBufferImpl_Release((IRpcProxyBuffer *)&This->lpvtbl_proxy);
}
static HRESULT WINAPI RemUnkProxy_RemQueryInterface(LPREMUNKNOWN iface,