Jacek Caban : shdocvw: Check QueryInterface return codes before using its result.

Alexandre Julliard julliard at winehq.org
Wed Nov 18 09:40:40 CST 2009


Module: wine
Branch: master
Commit: 60b096f60961e551d161167d910299eca7481f5d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=60b096f60961e551d161167d910299eca7481f5d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Nov 17 21:32:22 2009 +0100

shdocvw: Check QueryInterface return codes before using its result.

---

 dlls/shdocvw/oleobject.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/dlls/shdocvw/oleobject.c b/dlls/shdocvw/oleobject.c
index 3657a7a..dde850f 100644
--- a/dlls/shdocvw/oleobject.c
+++ b/dlls/shdocvw/oleobject.c
@@ -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)) {




More information about the wine-cvs mailing list