mshtml: Fix leak on failure in return_nsstr.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2022-01-07 17:43:44 +02:00 committed by Alexandre Julliard
parent 9206277105
commit 89317f533b
1 changed files with 3 additions and 2 deletions

View File

@ -917,6 +917,7 @@ HRESULT map_nsresult(nsresult nsres)
HRESULT return_nsstr(nsresult nsres, nsAString *nsstr, BSTR *p) HRESULT return_nsstr(nsresult nsres, nsAString *nsstr, BSTR *p)
{ {
const PRUnichar *str; const PRUnichar *str;
HRESULT hres = S_OK;
if(NS_FAILED(nsres)) { if(NS_FAILED(nsres)) {
WARN("failed: %08x\n", nsres); WARN("failed: %08x\n", nsres);
@ -929,13 +930,13 @@ HRESULT return_nsstr(nsresult nsres, nsAString *nsstr, BSTR *p)
if(*str) { if(*str) {
*p = SysAllocString(str); *p = SysAllocString(str);
if(!*p) if(!*p)
return E_OUTOFMEMORY; hres = E_OUTOFMEMORY;
}else { }else {
*p = NULL; *p = NULL;
} }
nsAString_Finish(nsstr); nsAString_Finish(nsstr);
return S_OK; return hres;
} }
HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, unsigned flags, VARIANT *p) HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, unsigned flags, VARIANT *p)