shdocvw: Check QueryInterface return codes before using its result.

This commit is contained in:
Jacek Caban 2009-11-17 21:32:22 +01:00 committed by Alexandre Julliard
parent 96073d5129
commit 60b096f609
1 changed files with 10 additions and 4 deletions

View File

@ -282,7 +282,9 @@ static ULONG WINAPI OleObject_Release(IOleObject *iface)
static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE pClientSite)
{
WebBrowser *This = OLEOBJ_THIS(iface);
IDocHostUIHandler *hostui;
IOleContainer *container;
IDispatch *disp;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, pClientSite);
@ -322,11 +324,15 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
IOleClientSite_AddRef(pClientSite);
IOleClientSite_QueryInterface(This->client, &IID_IDispatch,
(void**)&This->doc_host.client_disp);
hres = IOleClientSite_QueryInterface(This->client, &IID_IDispatch,
(void**)&disp);
if(SUCCEEDED(hres))
This->doc_host.client_disp = disp;
IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler,
(void**)&This->doc_host.hostui);
hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler,
(void**)&hostui);
if(SUCCEEDED(hres))
This->doc_host.hostui = hostui;
hres = IOleClientSite_GetContainer(This->client, &container);
if(SUCCEEDED(hres)) {