Commit b2643d38 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Fix handling of NULL object site (Coverity).

parent 21be19a1
......@@ -1444,34 +1444,37 @@ static HRESULT WINAPI httprequest_ObjectWithSite_GetSite( IObjectWithSite *iface
static HRESULT WINAPI httprequest_ObjectWithSite_SetSite( IObjectWithSite *iface, IUnknown *punk )
{
httprequest *This = impl_from_IObjectWithSite(iface);
IServiceProvider *provider;
HRESULT hr;
TRACE("(%p)->(%p)\n", iface, punk);
if (punk)
IUnknown_AddRef( punk );
TRACE("(%p)->(%p)\n", This, punk);
if(This->site)
IUnknown_Release( This->site );
SysFreeString(This->siteurl);
This->siteurl = NULL;
This->site = punk;
hr = IUnknown_QueryInterface(This->site, &IID_IServiceProvider, (void**)&provider);
if (hr == S_OK)
if (punk)
{
IHTMLDocument2 *doc;
IServiceProvider *provider;
HRESULT hr;
IUnknown_AddRef( punk );
hr = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument2, (void**)&doc);
hr = IUnknown_QueryInterface(This->site, &IID_IServiceProvider, (void**)&provider);
if (hr == S_OK)
{
SysFreeString(This->siteurl);
IHTMLDocument2 *doc;
hr = IHTMLDocument2_get_URL(doc, &This->siteurl);
IHTMLDocument2_Release(doc);
TRACE("host url %s, 0x%08x\n", debugstr_w(This->siteurl), hr);
hr = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument2, (void**)&doc);
if (hr == S_OK)
{
hr = IHTMLDocument2_get_URL(doc, &This->siteurl);
IHTMLDocument2_Release(doc);
TRACE("host url %s, 0x%08x\n", debugstr_w(This->siteurl), hr);
}
IServiceProvider_Release(provider);
}
IServiceProvider_Release(provider);
}
return S_OK;
......
......@@ -5213,6 +5213,9 @@ todo_wine {
EXPECT_REF(obj_site, 1);
}
hr = IObjectWithSite_SetSite(obj_site, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr);
IObjectWithSite_AddRef(obj_site);
todo_wine {
EXPECT_REF(obj_site, 2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment