mshtml: Avoid memory leaks (coverity)

Frédéric Delanoy frederic.delanoy at gmail.com
Sat Nov 30 08:16:08 CST 2013


CID 1131417
---
 dlls/mshtml/htmlbody.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c
index fcd8766..163f0ba 100644
--- a/dlls/mshtml/htmlbody.c
+++ b/dlls/mshtml/htmlbody.c
@@ -648,7 +648,8 @@ static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *
 
     if(!overflow || !*overflow) {
         *p = NULL;
-        return S_OK;
+        hres = S_OK;
+        goto cleanup;
     }else if(!strcmpW(overflow, visibleW) || !strcmpW(overflow, autoW)) {
         ret = autoW;
     }else if(!strcmpW(overflow, scrollW)) {
@@ -658,11 +659,16 @@ static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *
     }else {
         TRACE("Defaulting %s to NULL\n", debugstr_w(overflow));
         *p = NULL;
-        return S_OK;
+        hres = S_OK;
+        goto cleanup;
     }
 
     *p = SysAllocString(ret);
-    return *p ? S_OK : E_OUTOFMEMORY;
+    hres = *p ? S_OK : E_OUTOFMEMORY;
+
+cleanup:
+    SysFreeString(overflow);
+    return hres;
 }
 
 static HRESULT WINAPI HTMLBodyElement_put_onselect(IHTMLBodyElement *iface, VARIANT v)
-- 
1.8.5




More information about the wine-patches mailing list