Commit 4e5c4758 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

jscript: Fix some refcount leaks.

In particular, most leak when jsdisp->ctx is not the current ctx. Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 7ba8943e
......@@ -2028,6 +2028,7 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, uns
if(jsdisp && jsdisp->ctx == ctx) {
if(flags & DISPATCH_PROPERTYPUT) {
FIXME("disp_call(propput) on builtin object\n");
jsdisp_release(jsdisp);
return E_FAIL;
}
......@@ -2037,6 +2038,8 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, uns
jsdisp_release(jsdisp);
return hres;
}
if(jsdisp)
jsdisp_release(jsdisp);
flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
if(ret && argc)
......@@ -2106,6 +2109,8 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
jsdisp_release(jsdisp);
return hres;
}
if(jsdisp)
jsdisp_release(jsdisp);
flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
if(r && argc && flags == DISPATCH_METHOD)
......@@ -2205,6 +2210,8 @@ HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val)
VARIANT var;
DISPPARAMS dp = {&var, &dispid, 1, 1};
if(jsdisp)
jsdisp_release(jsdisp);
hres = jsval_to_variant(val, &var);
if(FAILED(hres))
return hres;
......@@ -2230,6 +2237,8 @@ HRESULT disp_propput_name(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name,
BSTR str;
DISPID id;
if(jsdisp)
jsdisp_release(jsdisp);
if(!(str = SysAllocString(name)))
return E_OUTOFMEMORY;
......@@ -2248,7 +2257,9 @@ HRESULT disp_propput_name(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name,
return disp_propput(ctx, disp, id, val);
}
return jsdisp_propput_name(jsdisp, name, val);
hres = jsdisp_propput_name(jsdisp, name, val);
jsdisp_release(jsdisp);
return hres;
}
HRESULT jsdisp_propget_name(jsdisp_t *obj, const WCHAR *name, jsval_t *val)
......@@ -2312,6 +2323,8 @@ HRESULT disp_propget(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t *val
jsdisp_release(jsdisp);
return hres;
}
if(jsdisp)
jsdisp_release(jsdisp);
V_VT(&var) = VT_EMPTY;
hres = disp_invoke(ctx, disp, id, INVOKE_PROPERTYGET, &dp, &var);
......
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