diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c index b8fabe1cab7..f99fe016e8d 100644 --- a/dlls/jscript/array.c +++ b/dlls/jscript/array.c @@ -133,6 +133,9 @@ static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP HRESULT hres; hres = to_number(ctx, get_arg(dp, 0), ei, &num); + if(FAILED(hres)) + return hres; + if(V_VT(&num) == VT_I4) len = V_I4(&num); else diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 9a5ecbcd2d3..1b56e63968a 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -2415,7 +2415,7 @@ static HRESULT typeof_exprval(script_ctx_t *ctx, exprval_t *exprval, jsexcept_t } VariantClear(&val); - return S_OK; + return hres; } HRESULT typeof_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index ff5364a4117..765fadeb19e 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -441,7 +441,8 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI } } - hres = call_function(ctx, function, this_obj, &args, retv, ei, caller); + if(SUCCEEDED(hres)) + hres = call_function(ctx, function, this_obj, &args, retv, ei, caller); if(this_obj) IDispatch_Release(this_obj); diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index a17b456dd58..e5123b40a0d 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -522,7 +522,8 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface, item->flags = dwFlags; item->name = heap_strdupW(pstrName); if(!item->name) { - IDispatch_Release(disp); + if(disp) + IDispatch_Release(disp); heap_free(item); return E_OUTOFMEMORY; } diff --git a/dlls/jscript/lex.c b/dlls/jscript/lex.c index 723f0ef7ed9..6dfe9377c94 100644 --- a/dlls/jscript/lex.c +++ b/dlls/jscript/lex.c @@ -249,7 +249,6 @@ static BOOL unescape(WCHAR *str) } p++; - c = 0; switch(*p) { case '\'': diff --git a/dlls/jscript/number.c b/dlls/jscript/number.c index f95a19a8006..82dd5bce2f0 100644 --- a/dlls/jscript/number.c +++ b/dlls/jscript/number.c @@ -150,7 +150,7 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D if(exp) { if(log_radix==0) - buf[idx++] = '\0'; + buf[idx] = 0; else { static const WCHAR formatW[] = {'(','e','%','c','%','d',')',0}; WCHAR ch;