jscript: Set output to undefined in jsval_copy on failure.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-07-28 18:45:13 +02:00 committed by Alexandre Julliard
parent 9fc2863ebd
commit e641469f9f
2 changed files with 7 additions and 5 deletions

View File

@ -491,10 +491,8 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val, IServi
TRACE("%s = %s\n", debugstr_w(prop->name), debugstr_jsval(val));
hres = jsval_copy(val, &prop->u.val);
if(FAILED(hres)) {
prop->u.val = jsval_undefined();
if(FAILED(hres))
return hres;
}
if(This->builtin_info->on_put)
This->builtin_info->on_put(This, prop->name);

View File

@ -212,13 +212,17 @@ static HRESULT jsval_variant(jsval_t *val, VARIANT *var)
__JSVAL_TYPE(*val) = JSV_VARIANT;
__JSVAL_VAR(*val) = v = heap_alloc(sizeof(VARIANT));
if(!v)
if(!v) {
*val = jsval_undefined();
return E_OUTOFMEMORY;
}
V_VT(v) = VT_EMPTY;
hres = VariantCopy(v, var);
if(FAILED(hres))
if(FAILED(hres)) {
*val = jsval_undefined();
heap_free(v);
}
return hres;
}