Jacek Caban : urlmon: Ensure that inner protocol handler reference is released after other references.
Alexandre Julliard
julliard at winehq.org
Tue May 22 15:37:13 CDT 2018
Module: wine
Branch: master
Commit: 52aefc06114441c5b6b2cbcbd84e6756c6286275
URL: https://source.winehq.org/git/wine.git/?a=commit;h=52aefc06114441c5b6b2cbcbd84e6756c6286275
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue May 22 10:13:59 2018 +0200
urlmon: Ensure that inner protocol handler reference is released after other references.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/urlmon/bindprot.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/dlls/urlmon/bindprot.c b/dlls/urlmon/bindprot.c
index 5965244..42d3d21 100644
--- a/dlls/urlmon/bindprot.c
+++ b/dlls/urlmon/bindprot.c
@@ -309,10 +309,6 @@ static ULONG WINAPI BindProtocol_AddRef(IInternetProtocolEx *iface)
static void release_protocol_handler(BindProtocol *This)
{
- if(This->protocol_unk) {
- IUnknown_Release(This->protocol_unk);
- This->protocol_unk = NULL;
- }
if(This->protocol) {
IInternetProtocol_Release(This->protocol);
This->protocol = NULL;
@@ -326,6 +322,10 @@ static void release_protocol_handler(BindProtocol *This)
IInternetProtocolSink_Release(This->protocol_sink_handler);
This->protocol_sink_handler = &This->default_protocol_handler.IInternetProtocolSink_iface;
}
+ if(This->protocol_unk) {
+ IUnknown_Release(This->protocol_unk);
+ This->protocol_unk = NULL;
+ }
}
static ULONG WINAPI BindProtocol_Release(IInternetProtocolEx *iface)
@@ -654,24 +654,25 @@ static HRESULT WINAPI ProtocolHandler_Start(IInternetProtocol *iface, LPCWSTR sz
static HRESULT WINAPI ProtocolHandler_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
{
BindProtocol *This = impl_from_IInternetProtocol(iface);
- IInternetProtocol *protocol;
+ IInternetProtocol *protocol = NULL;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, pProtocolData);
/* FIXME: This should not be needed. */
- if(!This->protocol && This->protocol_unk) {
+ if(!This->protocol) {
+ if(!This->protocol_unk)
+ return E_FAIL;
hres = IUnknown_QueryInterface(This->protocol_unk, &IID_IInternetProtocol, (void**)&protocol);
if(FAILED(hres))
return E_FAIL;
- }else {
- IInternetProtocol_AddRef(protocol = This->protocol);
}
- hres = IInternetProtocol_Continue(protocol, pProtocolData);
+ hres = IInternetProtocol_Continue(protocol ? protocol : This->protocol, pProtocolData);
heap_free(pProtocolData);
- IInternetProtocol_Release(protocol);
+ if(protocol)
+ IInternetProtocol_Release(protocol);
return hres;
}
More information about the wine-cvs
mailing list