In particular, most leak when jsdisp->ctx is not the current ctx.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/dispex.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index c7e4ba9..4c57a69 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -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);