Commit ec35d3ab authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added a few missing allocation checks (Coverity).

parent 43c7907f
......@@ -744,9 +744,13 @@ static HRESULT ArrayConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISP
static HRESULT alloc_array(script_ctx_t *ctx, BOOL use_constr, ArrayInstance **ret)
{
ArrayInstance *array = heap_alloc_zero(sizeof(ArrayInstance));
ArrayInstance *array;
HRESULT hres;
array = heap_alloc_zero(sizeof(ArrayInstance));
if(!array)
return E_OUTOFMEMORY;
if(use_constr)
hres = init_dispex_from_constr(&array->dispex, ctx, &Array_info, ctx->array_constr);
else
......
......@@ -758,6 +758,8 @@ HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pUn
lock_module();
ret = heap_alloc_zero(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;
ret->lpIActiveScriptVtbl = &JScriptVtbl;
ret->lpIActiveScriptParseVtbl = &JScriptParseVtbl;
......
......@@ -231,9 +231,13 @@ static HRESULT NumberConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DIS
static HRESULT alloc_number(script_ctx_t *ctx, BOOL use_constr, NumberInstance **ret)
{
NumberInstance *number = heap_alloc_zero(sizeof(NumberInstance));
NumberInstance *number;
HRESULT hres;
number = heap_alloc_zero(sizeof(NumberInstance));
if(!number)
return E_OUTOFMEMORY;
if(use_constr)
hres = init_dispex_from_constr(&number->dispex, ctx, &Number_info, ctx->number_constr);
else
......
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