Commit 60a592b7 authored by Frédéric Delanoy's avatar Frédéric Delanoy Committed by Alexandre Julliard

mshtml: Avoid memory leaks (Coverity).

parent 60ecf707
...@@ -635,7 +635,7 @@ static HRESULT WINAPI HTMLBodyElement_put_scroll(IHTMLBodyElement *iface, BSTR v ...@@ -635,7 +635,7 @@ static HRESULT WINAPI HTMLBodyElement_put_scroll(IHTMLBodyElement *iface, BSTR v
static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *p) static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *p)
{ {
HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface); HTMLBodyElement *This = impl_from_IHTMLBodyElement(iface);
const WCHAR *ret; const WCHAR *ret = NULL;
BSTR overflow; BSTR overflow;
HRESULT hres; HRESULT hres;
...@@ -648,7 +648,7 @@ static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR * ...@@ -648,7 +648,7 @@ static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *
if(!overflow || !*overflow) { if(!overflow || !*overflow) {
*p = NULL; *p = NULL;
return S_OK; hres = S_OK;
}else if(!strcmpW(overflow, visibleW) || !strcmpW(overflow, autoW)) { }else if(!strcmpW(overflow, visibleW) || !strcmpW(overflow, autoW)) {
ret = autoW; ret = autoW;
}else if(!strcmpW(overflow, scrollW)) { }else if(!strcmpW(overflow, scrollW)) {
...@@ -658,11 +658,16 @@ static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR * ...@@ -658,11 +658,16 @@ static HRESULT WINAPI HTMLBodyElement_get_scroll(IHTMLBodyElement *iface, BSTR *
}else { }else {
TRACE("Defaulting %s to NULL\n", debugstr_w(overflow)); TRACE("Defaulting %s to NULL\n", debugstr_w(overflow));
*p = NULL; *p = NULL;
return S_OK; hres = S_OK;
} }
*p = SysAllocString(ret); SysFreeString(overflow);
return *p ? S_OK : E_OUTOFMEMORY; if(ret) {
*p = SysAllocString(ret);
hres = *p ? S_OK : E_OUTOFMEMORY;
}
return hres;
} }
static HRESULT WINAPI HTMLBodyElement_put_onselect(IHTMLBodyElement *iface, VARIANT v) static HRESULT WINAPI HTMLBodyElement_put_onselect(IHTMLBodyElement *iface, VARIANT v)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment