Jacek Caban : mshtml: Fixed a few coverity issues.

Alexandre Julliard julliard at winehq.org
Tue Nov 27 14:30:49 CST 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Nov 27 12:16:34 2012 +0100

mshtml: Fixed a few coverity issues.

---

 dlls/mshtml/navigate.c   |   16 ++++++++--------
 dlls/mshtml/nsembed.c    |    1 +
 dlls/mshtml/nsio.c       |   12 +++++++++---
 dlls/mshtml/pluginhost.c |    4 +++-
 dlls/mshtml/protocol.c   |    9 +++++++--
 5 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index 346524d..fb4f1e8 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -800,15 +800,16 @@ HRESULT start_binding(HTMLInnerWindow *inner_window, BSCallback *bscallback, IBi
     /* NOTE: IE7 calls IsSystemMoniker here*/
 
     if(bctx) {
-        RegisterBindStatusCallback(bctx, &bscallback->IBindStatusCallback_iface, NULL, 0);
-        IBindCtx_AddRef(bctx);
+        hres = RegisterBindStatusCallback(bctx, &bscallback->IBindStatusCallback_iface, NULL, 0);
+        if(SUCCEEDED(hres))
+            IBindCtx_AddRef(bctx);
     }else {
         hres = CreateAsyncBindCtx(0, &bscallback->IBindStatusCallback_iface, NULL, &bctx);
-        if(FAILED(hres)) {
-            WARN("CreateAsyncBindCtx failed: %08x\n", hres);
-            bscallback->vtbl->stop_binding(bscallback, hres);
-            return hres;
-        }
+    }
+
+    if(FAILED(hres)) {
+        bscallback->vtbl->stop_binding(bscallback, hres);
+        return hres;
     }
 
     hres = IMoniker_BindToStorage(bscallback->mon, bctx, NULL, &IID_IStream, (void**)&str);
@@ -1473,7 +1474,6 @@ static void handle_navigation_error(nsChannelBSC *This, DWORD result)
         return;
 
     if(!doc->client_cmdtrg)
-    if(FAILED(hres))
         return;
 
     bound.lLbound = 0;
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index c93673a..5593c6b 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -280,6 +280,7 @@ static nsresult NSAPI nsDirectoryServiceProvider2_GetFile(nsIDirectoryServicePro
                 return nsres;
         }
 
+        assert(profile_directory != NULL);
         return nsIFile_Clone(profile_directory, _retval);
     }
 
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index 89a7fe8..c8bbdd8 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -1042,10 +1042,16 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
         return NS_ERROR_FAILURE;
 
     if(TRACE_ON(mshtml)) {
+        HRESULT hres;
         BSTR uri_str;
-        IUri_GetDisplayUri(This->uri->uri, &uri_str);
-        TRACE("opening %s\n", debugstr_w(uri_str));
-        SysFreeString(uri_str);
+
+        hres = IUri_GetDisplayUri(This->uri->uri, &uri_str);
+        if(SUCCEEDED(hres)) {
+            TRACE("opening %s\n", debugstr_w(uri_str));
+            SysFreeString(uri_str);
+        }else {
+            WARN("GetDisplayUri failed: %08x\n", hres);
+        }
     }
 
     if(This->uri->is_doc_uri) {
diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c
index 4f088ad..38a8fd5 100644
--- a/dlls/mshtml/pluginhost.c
+++ b/dlls/mshtml/pluginhost.c
@@ -1301,8 +1301,10 @@ static HRESULT WINAPI PHInPlaceSite_GetWindowContext(IOleInPlaceSiteEx *iface,
         return hres;
 
     hres = create_ip_window(ppDoc);
-    if(FAILED(hres))
+    if(FAILED(hres)) {
+        IOleInPlaceFrame_Release(ip_frame);
         return hres;
+    }
 
     *ppFrame = ip_frame;
     *lprcPosRect = This->rect;
diff --git a/dlls/mshtml/protocol.c b/dlls/mshtml/protocol.c
index d9a008c..021ce55 100644
--- a/dlls/mshtml/protocol.c
+++ b/dlls/mshtml/protocol.c
@@ -218,6 +218,7 @@ static HRESULT WINAPI AboutProtocol_Start(IInternetProtocol *iface, LPCWSTR szUr
     LPCWSTR text = NULL;
     DWORD data_len;
     BYTE *data;
+    HRESULT hres;
 
     static const WCHAR html_begin[] = {0xfeff,'<','H','T','M','L','>',0};
     static const WCHAR html_end[] = {'<','/','H','T','M','L','>',0};
@@ -237,7 +238,9 @@ static HRESULT WINAPI AboutProtocol_Start(IInternetProtocol *iface, LPCWSTR szUr
 
     memset(&bindinfo, 0, sizeof(bindinfo));
     bindinfo.cbSize = sizeof(BINDINFO);
-    IInternetBindInfo_GetBindInfo(pOIBindInfo, &grfBINDF, &bindinfo);
+    hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &grfBINDF, &bindinfo);
+    if(FAILED(hres))
+        return hres;
     ReleaseBindInfo(&bindinfo);
 
     TRACE("bindf %x\n", grfBINDF);
@@ -605,7 +608,9 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
 
     memset(&bindinfo, 0, sizeof(bindinfo));
     bindinfo.cbSize = sizeof(BINDINFO);
-    IInternetBindInfo_GetBindInfo(pOIBindInfo, &grfBINDF, &bindinfo);
+    hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &grfBINDF, &bindinfo);
+    if(FAILED(hres))
+        return hres;
     ReleaseBindInfo(&bindinfo);
 
     len = strlenW(szUrl)+16;




More information about the wine-cvs mailing list