Jacek Caban : mshtml: Properly handle OOM errors in omnavigator.c (coverity ).

Alexandre Julliard julliard at winehq.org
Fri Oct 19 13:33:53 CDT 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Oct 19 11:57:47 2012 +0200

mshtml: Properly handle OOM errors in omnavigator.c (coverity).

---

 dlls/mshtml/htmlwindow.c  |    2 +-
 dlls/mshtml/omnavigator.c |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index dede0a7..0fad7aa 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -803,7 +803,7 @@ static HRESULT WINAPI HTMLWindow2_get_navigator(IHTMLWindow2 *iface, IOmNavigato
     TRACE("(%p)->(%p)\n", This, p);
 
     *p = OmNavigator_Create();
-    return S_OK;
+    return *p ? S_OK : E_OUTOFMEMORY;
 }
 
 static HRESULT WINAPI HTMLWindow2_put_name(IHTMLWindow2 *iface, BSTR v)
diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c
index 6d7ec15..51421d3 100644
--- a/dlls/mshtml/omnavigator.c
+++ b/dlls/mshtml/omnavigator.c
@@ -941,6 +941,9 @@ IOmNavigator *OmNavigator_Create(void)
     OmNavigator *ret;
 
     ret = heap_alloc_zero(sizeof(*ret));
+    if(!ret)
+        return NULL;
+
     ret->IOmNavigator_iface.lpVtbl = &OmNavigatorVtbl;
     ret->ref = 1;
 




More information about the wine-cvs mailing list