1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 20:06:18 +00:00

jscript: Use CRT allocation functions.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2022-11-21 20:43:43 +02:00 committed by Alexandre Julliard
parent a08eb8969a
commit ae73e09a8d
24 changed files with 163 additions and 164 deletions

View File

@ -242,7 +242,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
return S_OK;
}
str_tab = heap_alloc_zero(length * sizeof(*str_tab));
str_tab = calloc(length, sizeof(*str_tab));
if(!str_tab)
return E_OUTOFMEMORY;
@ -304,7 +304,7 @@ static HRESULT array_join(script_ctx_t *ctx, jsdisp_t *array, DWORD length, cons
if(str_tab[i])
jsstr_release(str_tab[i]);
}
heap_free(str_tab);
free(str_tab);
if(FAILED(hres))
return hres;
@ -720,7 +720,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
goto done;
}
vtab = heap_alloc_zero(length * sizeof(*vtab));
vtab = calloc(length, sizeof(*vtab));
if(vtab) {
for(i=0; i<length; i++) {
hres = jsdisp_get_idx(jsthis, i, vtab+i);
@ -737,7 +737,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
}
if(SUCCEEDED(hres)) {
sorttab = heap_alloc(length*2*sizeof(*sorttab));
sorttab = malloc(length*2*sizeof(*sorttab));
if(!sorttab)
hres = E_OUTOFMEMORY;
}
@ -809,9 +809,9 @@ static HRESULT Array_sort(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
if(vtab) {
for(i=0; i < length; i++)
jsval_release(vtab[i]);
heap_free(vtab);
free(vtab);
}
heap_free(sorttab);
free(sorttab);
if(cmp_func)
jsdisp_release(cmp_func);
@ -1607,7 +1607,7 @@ done:
static void Array_destructor(jsdisp_t *dispex)
{
heap_free(dispex);
free(dispex);
}
static void Array_on_put(jsdisp_t *dispex, const WCHAR *name)
@ -1755,7 +1755,7 @@ static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayI
ArrayInstance *array;
HRESULT hres;
array = heap_alloc_zero(sizeof(ArrayInstance));
array = calloc(1, sizeof(ArrayInstance));
if(!array)
return E_OUTOFMEMORY;
@ -1765,7 +1765,7 @@ static HRESULT alloc_array(script_ctx_t *ctx, jsdisp_t *object_prototype, ArrayI
hres = init_dispex_from_constr(&array->dispex, ctx, &ArrayInst_info, ctx->array_constr);
if(FAILED(hres)) {
heap_free(array);
free(array);
return hres;
}

View File

@ -180,7 +180,7 @@ static HRESULT alloc_bool(script_ctx_t *ctx, jsdisp_t *object_prototype, BoolIns
BoolInstance *bool;
HRESULT hres;
bool = heap_alloc_zero(sizeof(BoolInstance));
bool = calloc(1, sizeof(BoolInstance));
if(!bool)
return E_OUTOFMEMORY;
@ -190,7 +190,7 @@ static HRESULT alloc_bool(script_ctx_t *ctx, jsdisp_t *object_prototype, BoolIns
hres = init_dispex_from_constr(&bool->dispex, ctx, &BoolInst_info, ctx->bool_constr);
if(FAILED(hres)) {
heap_free(bool);
free(bool);
return hres;
}

View File

@ -153,7 +153,7 @@ static BOOL alloc_local_scope(compiler_ctx_t *ctx, unsigned int *scope_index)
if (scope == ctx->local_scope_size)
{
new_size = max(1, ctx->local_scope_size * 2);
if (!(new_alloc = heap_realloc(ctx->local_scopes, new_size * sizeof(*ctx->local_scopes))))
if (!(new_alloc = realloc(ctx->local_scopes, new_size * sizeof(*ctx->local_scopes))))
return FALSE;
ctx->local_scopes = new_alloc;
ctx->local_scope_size = new_size;
@ -191,14 +191,14 @@ jsstr_t *compiler_alloc_string_len(compiler_ctx_t *ctx, const WCHAR *str, unsign
jsstr_t *new_str;
if(!ctx->code->str_pool_size) {
ctx->code->str_pool = heap_alloc(8 * sizeof(jsstr_t*));
ctx->code->str_pool = malloc(8 * sizeof(jsstr_t*));
if(!ctx->code->str_pool)
return NULL;
ctx->code->str_pool_size = 8;
}else if(ctx->code->str_pool_size == ctx->code->str_cnt) {
jsstr_t **new_pool;
new_pool = heap_realloc(ctx->code->str_pool, ctx->code->str_pool_size*2*sizeof(jsstr_t*));
new_pool = realloc(ctx->code->str_pool, ctx->code->str_pool_size*2*sizeof(jsstr_t*));
if(!new_pool)
return NULL;
@ -222,14 +222,14 @@ static jsstr_t *compiler_alloc_string(compiler_ctx_t *ctx, const WCHAR *str)
static BOOL ensure_bstr_slot(compiler_ctx_t *ctx)
{
if(!ctx->code->bstr_pool_size) {
ctx->code->bstr_pool = heap_alloc(8 * sizeof(BSTR));
ctx->code->bstr_pool = malloc(8 * sizeof(BSTR));
if(!ctx->code->bstr_pool)
return FALSE;
ctx->code->bstr_pool_size = 8;
}else if(ctx->code->bstr_pool_size == ctx->code->bstr_cnt) {
BSTR *new_pool;
new_pool = heap_realloc(ctx->code->bstr_pool, ctx->code->bstr_pool_size*2*sizeof(BSTR));
new_pool = realloc(ctx->code->bstr_pool, ctx->code->bstr_pool_size*2*sizeof(BSTR));
if(!new_pool)
return FALSE;
@ -276,7 +276,7 @@ static unsigned push_instr(compiler_ctx_t *ctx, jsop_t op)
if(ctx->code_size == ctx->code_off) {
instr_t *new_instrs;
new_instrs = heap_realloc(ctx->code->instrs, ctx->code_size*2*sizeof(instr_t));
new_instrs = realloc(ctx->code->instrs, ctx->code_size*2*sizeof(instr_t));
if(!new_instrs)
return 0;
@ -457,14 +457,14 @@ static HRESULT compile_member_expression(compiler_ctx_t *ctx, member_expression_
static unsigned alloc_label(compiler_ctx_t *ctx)
{
if(!ctx->labels_size) {
ctx->labels = heap_alloc(8 * sizeof(*ctx->labels));
ctx->labels = malloc(8 * sizeof(*ctx->labels));
if(!ctx->labels)
return 0;
ctx->labels_size = 8;
}else if(ctx->labels_size == ctx->labels_cnt) {
unsigned *new_labels;
new_labels = heap_realloc(ctx->labels, 2*ctx->labels_size*sizeof(*ctx->labels));
new_labels = realloc(ctx->labels, 2*ctx->labels_size*sizeof(*ctx->labels));
if(!new_labels)
return 0;
@ -1741,7 +1741,7 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
case_cnt++;
}
case_jmps = heap_alloc(case_cnt * sizeof(*case_jmps));
case_jmps = malloc(case_cnt * sizeof(*case_jmps));
if(!case_jmps)
return E_OUTOFMEMORY;
@ -1775,7 +1775,7 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
}
if(FAILED(hres)) {
heap_free(case_jmps);
free(case_jmps);
return hres;
}
@ -1798,7 +1798,7 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
break;
}
heap_free(case_jmps);
free(case_jmps);
if(FAILED(hres))
return hres;
assert(i == case_cnt);
@ -2466,12 +2466,12 @@ void release_bytecode(bytecode_t *code)
if(code->named_item)
release_named_item(code->named_item);
heap_free(code->source);
free(code->source);
heap_pool_free(&code->heap);
heap_free(code->bstr_pool);
heap_free(code->str_pool);
heap_free(code->instrs);
heap_free(code);
free(code->bstr_pool);
free(code->str_pool);
free(code->instrs);
free(code);
}
static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source, UINT64 source_context, unsigned start_line)
@ -2481,7 +2481,7 @@ static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source, UINT64 s
if(len > INT32_MAX)
return E_OUTOFMEMORY;
compiler->code = heap_alloc_zero(sizeof(bytecode_t));
compiler->code = calloc(1, sizeof(bytecode_t));
if(!compiler->code)
return E_OUTOFMEMORY;
@ -2490,7 +2490,7 @@ static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source, UINT64 s
compiler->code->start_line = start_line;
heap_pool_init(&compiler->code->heap);
compiler->code->source = heap_alloc((len + 1) * sizeof(WCHAR));
compiler->code->source = malloc((len + 1) * sizeof(WCHAR));
if(!compiler->code->source) {
release_bytecode(compiler->code);
return E_OUTOFMEMORY;
@ -2499,7 +2499,7 @@ static HRESULT init_code(compiler_ctx_t *compiler, const WCHAR *source, UINT64 s
memcpy(compiler->code->source, source, len * sizeof(WCHAR));
compiler->code->source[len] = 0;
compiler->code->instrs = heap_alloc(64 * sizeof(instr_t));
compiler->code->instrs = malloc(64 * sizeof(instr_t));
if(!compiler->code->instrs) {
release_bytecode(compiler->code);
return E_OUTOFMEMORY;
@ -2751,7 +2751,7 @@ HRESULT compile_script(script_ctx_t *ctx, const WCHAR *code, UINT64 source_conte
heap_pool_init(&compiler.heap);
hres = compile_function(&compiler, compiler.parser->source, NULL, from_eval, &compiler.code->global_code);
heap_free(compiler.local_scopes);
free(compiler.local_scopes);
heap_pool_free(&compiler.heap);
parser_release(compiler.parser);
if(FAILED(hres)) {

View File

@ -1924,7 +1924,7 @@ static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE
GetTimeZoneInformation(&tzi);
date = heap_alloc_zero(sizeof(DateInstance));
date = calloc(1, sizeof(DateInstance));
if(!date)
return E_OUTOFMEMORY;
@ -1933,7 +1933,7 @@ static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE
else
hres = init_dispex_from_constr(&date->dispex, ctx, &DateInst_info, ctx->date_constr);
if(FAILED(hres)) {
heap_free(date);
free(date);
return hres;
}
@ -1986,7 +1986,7 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
else if(!nest_level) parse_len++;
}
parse = heap_alloc((parse_len+1)*sizeof(WCHAR));
parse = malloc((parse_len+1)*sizeof(WCHAR));
if(!parse)
return E_OUTOFMEMORY;
nest_level = 0;
@ -2009,12 +2009,12 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
lcid_en = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT);
for(i=0; i<ARRAY_SIZE(string_ids); i++) {
size = GetLocaleInfoW(lcid_en, string_ids[i], NULL, 0);
strings[i] = heap_alloc((size+1)*sizeof(WCHAR));
strings[i] = malloc((size+1)*sizeof(WCHAR));
if(!strings[i]) {
i--;
while(i-- >= 0)
heap_free(strings[i]);
heap_free(parse);
free(strings[i]);
free(parse);
return E_OUTOFMEMORY;
}
GetLocaleInfoW(lcid_en, string_ids[i], strings[i], size);
@ -2222,8 +2222,8 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
}
for(i=0; i<ARRAY_SIZE(string_ids); i++)
heap_free(strings[i]);
heap_free(parse);
free(strings[i]);
free(parse);
return S_OK;
}

View File

@ -426,7 +426,7 @@ static HRESULT scope_push(scope_chain_t *scope, jsdisp_t *jsobj, IDispatch *obj,
{
scope_chain_t *new_scope;
new_scope = heap_alloc(sizeof(scope_chain_t));
new_scope = malloc(sizeof(scope_chain_t));
if(!new_scope)
return E_OUTOFMEMORY;
@ -463,7 +463,7 @@ void scope_release(scope_chain_t *scope)
if (scope->obj)
IDispatch_Release(scope->obj);
heap_free(scope);
free(scope);
}
static HRESULT disp_get_id(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name, BSTR name_bstr, DWORD flags, DISPID *id)
@ -1115,7 +1115,7 @@ static HRESULT interp_push_except(script_ctx_t *ctx)
TRACE("\n");
except = heap_alloc(sizeof(*except));
except = malloc(sizeof(*except));
if(!except)
return E_OUTOFMEMORY;
@ -1143,7 +1143,7 @@ static HRESULT interp_pop_except(script_ctx_t *ctx)
finally_off = except->finally_off;
frame->except_frame = except->next;
heap_free(except);
free(except);
if(finally_off) {
HRESULT hres;
@ -2944,7 +2944,7 @@ static void pop_call_frame(script_ctx_t *ctx)
IDispatch_Release(frame->this_obj);
jsval_release(frame->ret);
release_bytecode(frame->bytecode);
heap_free(frame);
free(frame);
}
static void print_backtrace(script_ctx_t *ctx)
@ -3056,7 +3056,7 @@ static HRESULT unwind_exception(script_ctx_t *ctx, HRESULT exception_hres)
except_frame->catch_off = 0;
}else {
frame->except_frame = except_frame->next;
heap_free(except_frame);
free(except_frame);
}
hres = stack_push(ctx, except_val);
@ -3231,7 +3231,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
HRESULT hres;
if(!ctx->stack) {
ctx->stack = heap_alloc(stack_size * sizeof(*ctx->stack));
ctx->stack = malloc(stack_size * sizeof(*ctx->stack));
if(!ctx->stack)
return E_OUTOFMEMORY;
}
@ -3331,7 +3331,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
goto fail;
}
frame = heap_alloc_zero(sizeof(*frame));
frame = calloc(1, sizeof(*frame));
if(!frame) {
hres = E_OUTOFMEMORY;
goto fail;
@ -3346,7 +3346,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
hres = setup_scope(ctx, frame, scope, variable_obj, argc, argv);
if(FAILED(hres)) {
release_bytecode(frame->bytecode);
heap_free(frame);
free(frame);
goto fail;
}
}else if(scope) {

View File

@ -85,7 +85,7 @@ static void Enumerator_destructor(jsdisp_t *dispex)
TRACE("\n");
jsval_release(This->item);
heap_free(dispex);
free(dispex);
}
static HRESULT Enumerator_atEnd(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv,
@ -197,7 +197,7 @@ static HRESULT alloc_enumerator(script_ctx_t *ctx, jsdisp_t *object_prototype, E
EnumeratorInstance *enumerator;
HRESULT hres;
enumerator = heap_alloc_zero(sizeof(EnumeratorInstance));
enumerator = calloc(1, sizeof(EnumeratorInstance));
if(!enumerator)
return E_OUTOFMEMORY;
@ -209,7 +209,7 @@ static HRESULT alloc_enumerator(script_ctx_t *ctx, jsdisp_t *object_prototype, E
if(FAILED(hres))
{
heap_free(enumerator);
free(enumerator);
return hres;
}

View File

@ -162,7 +162,7 @@ static HRESULT alloc_error(script_ctx_t *ctx, jsdisp_t *prototype,
jsdisp_t *err;
HRESULT hres;
err = heap_alloc_zero(sizeof(*err));
err = calloc(1, sizeof(*err));
if(!err)
return E_OUTOFMEMORY;
@ -172,7 +172,7 @@ static HRESULT alloc_error(script_ctx_t *ctx, jsdisp_t *prototype,
hres = init_dispex_from_constr(err, ctx, &ErrorInst_info,
constr ? constr : ctx->error_constr);
if(FAILED(hres)) {
heap_free(err);
free(err);
return hres;
}

View File

@ -105,11 +105,11 @@ static void Arguments_destructor(jsdisp_t *jsdisp)
unsigned i;
for(i = 0; i < arguments->argc; i++)
jsval_release(arguments->buf[i]);
heap_free(arguments->buf);
free(arguments->buf);
}
jsdisp_release(&arguments->function->function.dispex);
heap_free(arguments);
free(arguments);
}
static unsigned Arguments_idx_length(jsdisp_t *jsdisp)
@ -182,13 +182,13 @@ HRESULT setup_arguments_object(script_ctx_t *ctx, call_frame_t *frame)
ArgumentsInstance *args;
HRESULT hres;
args = heap_alloc_zero(sizeof(*args));
args = calloc(1, sizeof(*args));
if(!args)
return E_OUTOFMEMORY;
hres = init_dispex_from_constr(&args->jsdisp, ctx, &Arguments_info, ctx->object_constr);
if(FAILED(hres)) {
heap_free(args);
free(args);
return hres;
}
@ -226,7 +226,7 @@ void detach_arguments_object(jsdisp_t *args_disp)
/* Don't bother coppying arguments if call frame holds the last reference. */
if(arguments->jsdisp.ref > 1) {
arguments->buf = heap_alloc(arguments->argc * sizeof(*arguments->buf));
arguments->buf = malloc(arguments->argc * sizeof(*arguments->buf));
if(arguments->buf) {
int i;
@ -315,7 +315,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, unsigned *a
if(FAILED(hres))
return hres;
argv = heap_alloc(length * sizeof(*argv));
argv = malloc(length * sizeof(*argv));
if(!argv)
return E_OUTOFMEMORY;
@ -326,7 +326,7 @@ static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, unsigned *a
}else if(FAILED(hres)) {
while(i--)
jsval_release(argv[i]);
heap_free(argv);
free(argv);
return hres;
}
}
@ -405,7 +405,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi
jsval_release(this_val);
for(i=0; i < cnt; i++)
jsval_release(args[i]);
heap_free(args);
free(args);
return hres;
}
@ -551,7 +551,7 @@ static void Function_destructor(jsdisp_t *dispex)
{
FunctionInstance *function = function_from_jsdisp(dispex);
function->vtbl->destructor(function);
heap_free(function);
free(function);
}
static const builtin_prop_t Function_props[] = {
@ -592,7 +592,7 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_
FunctionInstance *function;
HRESULT hres;
function = heap_alloc_zero(size);
function = calloc(1, size);
if(!function)
return E_OUTOFMEMORY;
@ -603,7 +603,7 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_
else
hres = init_dispex_from_constr(&function->dispex, ctx, &FunctionInst_info, ctx->function_constr);
if(FAILED(hres)) {
heap_free(function);
free(function);
return hres;
}
@ -840,7 +840,7 @@ static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsva
call_argc = function->argc + argc;
if(call_argc) {
call_args = heap_alloc(call_argc * sizeof(*call_args));
call_args = malloc(call_argc * sizeof(*call_args));
if(!call_args)
return E_OUTOFMEMORY;
@ -852,7 +852,7 @@ static HRESULT BindFunction_call(script_ctx_t *ctx, FunctionInstance *func, jsva
hres = function->target->vtbl->call(ctx, function->target, function->this, flags, call_argc, call_args, r);
heap_free(call_args);
free(call_args);
return hres;
}
@ -936,7 +936,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
static const WCHAR function_endW[] = L"\n}";
if(argc) {
params = heap_alloc(argc*sizeof(*params));
params = malloc(argc*sizeof(*params));
if(!params)
return E_OUTOFMEMORY;
@ -952,7 +952,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
if(SUCCEEDED(hres)) {
len += ARRAY_SIZE(function_anonymousW) + ARRAY_SIZE(function_beginW) + ARRAY_SIZE(function_endW) - 2;
str = heap_alloc(len*sizeof(WCHAR));
str = malloc(len*sizeof(WCHAR));
if(str) {
memcpy(str, function_anonymousW, sizeof(function_anonymousW));
ptr = str + ARRAY_SIZE(function_anonymousW) - 1;
@ -979,13 +979,13 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
while(i)
jsstr_release(params[--i]);
heap_free(params);
free(params);
if(FAILED(hres))
return hres;
hres = compile_script(ctx, str, 0, 0, NULL, NULL, FALSE, FALSE,
ctx->call_ctx ? ctx->call_ctx->bytecode->named_item : NULL, &code);
heap_free(str);
free(str);
if(FAILED(hres))
return hres;

View File

@ -83,7 +83,7 @@ void script_release(script_ctx_t *ctx)
if(ctx->last_match)
jsstr_release(ctx->last_match);
assert(!ctx->stack_top);
heap_free(ctx->stack);
free(ctx->stack);
ctx->jscaller->ctx = NULL;
IServiceProvider_Release(&ctx->jscaller->IServiceProvider_iface);

View File

@ -31,7 +31,6 @@
#include "resource.h"
#include "wine/heap.h"
#include "wine/list.h"
/*

View File

@ -74,7 +74,7 @@ static HRESULT parse_json_string(json_parse_ctx_t *ctx, WCHAR **r)
}
len = ctx->ptr-ptr;
buf = heap_alloc((len+1)*sizeof(WCHAR));
buf = malloc((len+1)*sizeof(WCHAR));
if(!buf)
return E_OUTOFMEMORY;
if(len)
@ -82,7 +82,7 @@ static HRESULT parse_json_string(json_parse_ctx_t *ctx, WCHAR **r)
if(!unescape(buf, &len)) {
FIXME("unescape failed\n");
heap_free(buf);
free(buf);
return E_FAIL;
}
@ -144,7 +144,7 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
if(skip_spaces(ctx) != ':') {
FIXME("missing ':'\n");
heap_free(prop_name);
free(prop_name);
break;
}
@ -154,7 +154,7 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
hres = jsdisp_propput_name(obj, prop_name, val);
jsval_release(val);
}
heap_free(prop_name);
free(prop_name);
if(FAILED(hres))
break;
@ -186,7 +186,7 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
/* FIXME: avoid reallocation */
str = jsstr_alloc(string);
heap_free(string);
free(string);
if(!str)
return E_OUTOFMEMORY;
@ -435,14 +435,14 @@ typedef struct {
static BOOL stringify_push_obj(stringify_ctx_t *ctx, jsdisp_t *obj)
{
if(!ctx->stack_size) {
ctx->stack = heap_alloc(4*sizeof(*ctx->stack));
ctx->stack = malloc(4*sizeof(*ctx->stack));
if(!ctx->stack)
return FALSE;
ctx->stack_size = 4;
}else if(ctx->stack_top == ctx->stack_size) {
jsdisp_t **new_stack;
new_stack = heap_realloc(ctx->stack, ctx->stack_size*2*sizeof(*ctx->stack));
new_stack = realloc(ctx->stack, ctx->stack_size*2*sizeof(*ctx->stack));
if(!new_stack)
return FALSE;
ctx->stack = new_stack;
@ -471,7 +471,7 @@ static BOOL is_on_stack(stringify_ctx_t *ctx, jsdisp_t *obj)
static BOOL append_string_len(stringify_ctx_t *ctx, const WCHAR *str, size_t len)
{
if(!ctx->buf_size) {
ctx->buf = heap_alloc(len*2*sizeof(WCHAR));
ctx->buf = malloc(len*2*sizeof(WCHAR));
if(!ctx->buf)
return FALSE;
ctx->buf_size = len*2;
@ -480,7 +480,7 @@ static BOOL append_string_len(stringify_ctx_t *ctx, const WCHAR *str, size_t len
size_t new_size;
new_size = ctx->buf_size * 2 + len;
new_buf = heap_realloc(ctx->buf, new_size*sizeof(WCHAR));
new_buf = realloc(ctx->buf, new_size*sizeof(WCHAR));
if(!new_buf)
return FALSE;
ctx->buf = new_buf;
@ -938,8 +938,8 @@ fail:
jsdisp_release(obj);
if(stringify_ctx.replacer)
jsdisp_release(stringify_ctx.replacer);
heap_free(stringify_ctx.buf);
heap_free(stringify_ctx.stack);
free(stringify_ctx.buf);
free(stringify_ctx.stack);
return hres;
}
@ -962,13 +962,13 @@ HRESULT create_json(script_ctx_t *ctx, jsdisp_t **ret)
jsdisp_t *json;
HRESULT hres;
json = heap_alloc_zero(sizeof(*json));
json = calloc(1, sizeof(*json));
if(!json)
return E_OUTOFMEMORY;
hres = init_dispex_from_constr(json, ctx, &JSON_info, ctx->object_constr);
if(FAILED(hres)) {
heap_free(json);
free(json);
return hres;
}

View File

@ -149,7 +149,7 @@ HRESULT regexp_match_next(script_ctx_t *ctx, jsdisp_t *dispex,
heap_pool_clear(mark);
if(hres != S_OK && (rem_flags & REM_ALLOC_RESULT)) {
heap_free(match);
free(match);
*ret = NULL;
}
@ -193,11 +193,11 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *jsstr,
if(ret) {
match_result_t *old_ret = ret;
ret = heap_realloc(old_ret, (ret_size <<= 1) * sizeof(match_result_t));
ret = realloc(old_ret, (ret_size <<= 1) * sizeof(match_result_t));
if(!ret)
heap_free(old_ret);
free(old_ret);
}else {
ret = heap_alloc((ret_size=4) * sizeof(match_result_t));
ret = malloc((ret_size=4) * sizeof(match_result_t));
}
if(!ret) {
hres = E_OUTOFMEMORY;
@ -216,7 +216,7 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *jsstr,
heap_pool_clear(mark);
if(FAILED(hres)) {
heap_free(ret);
free(ret);
return hres;
}
@ -545,7 +545,7 @@ static void RegExp_destructor(jsdisp_t *dispex)
regexp_destroy(This->jsregexp);
jsval_release(This->last_index_val);
jsstr_release(This->str);
heap_free(This);
free(This);
}
static const builtin_prop_t RegExp_props[] = {
@ -590,7 +590,7 @@ static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegEx
RegExpInstance *regexp;
HRESULT hres;
regexp = heap_alloc_zero(sizeof(RegExpInstance));
regexp = calloc(1, sizeof(RegExpInstance));
if(!regexp)
return E_OUTOFMEMORY;
@ -600,7 +600,7 @@ static HRESULT alloc_regexp(script_ctx_t *ctx, jsdisp_t *object_prototype, RegEx
hres = init_dispex_from_constr(&regexp->dispex, ctx, &RegExpInst_info, ctx->regexp_constr);
if(FAILED(hres)) {
heap_free(regexp);
free(regexp);
return hres;
}
@ -780,7 +780,7 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *jsstr, jsv
break;
}
heap_free(match_result);
free(match_result);
if(SUCCEEDED(hres) && r)
*r = jsval_obj(array);

View File

@ -45,7 +45,7 @@ void jsstr_free(jsstr_t *str)
{
switch(jsstr_tag(str)) {
case JSSTR_HEAP:
heap_free(jsstr_as_heap(str)->buf);
free(jsstr_as_heap(str)->buf);
break;
case JSSTR_ROPE: {
jsstr_rope_t *rope = jsstr_as_rope(str);
@ -57,7 +57,7 @@ void jsstr_free(jsstr_t *str)
break;
}
heap_free(str);
free(str);
}
static inline void jsstr_init(jsstr_t *str, unsigned len, jsstr_tag_t tag)
@ -73,7 +73,7 @@ jsstr_t *jsstr_alloc_buf(unsigned len, WCHAR **buf)
if(len > JSSTR_MAX_LENGTH)
return NULL;
ret = heap_alloc(FIELD_OFFSET(jsstr_inline_t, buf[len+1]));
ret = malloc(FIELD_OFFSET(jsstr_inline_t, buf[len+1]));
if(!ret)
return NULL;
@ -234,7 +234,7 @@ jsstr_t *jsstr_concat(jsstr_t *str1, jsstr_t *str2)
if(len1+len2 > JSSTR_MAX_LENGTH)
return NULL;
rope = heap_alloc(sizeof(*rope));
rope = malloc(sizeof(*rope));
if(!rope)
return NULL;
@ -262,7 +262,7 @@ const WCHAR *jsstr_rope_flatten(jsstr_rope_t *str)
{
WCHAR *buf;
buf = heap_alloc((jsstr_length(&str->str)+1) * sizeof(WCHAR));
buf = malloc((jsstr_length(&str->str)+1) * sizeof(WCHAR));
if(!buf)
return NULL;

View File

@ -72,12 +72,12 @@ void *heap_pool_alloc(heap_pool_t *heap, DWORD size)
if(!heap->block_cnt) {
if(!heap->blocks) {
heap->blocks = heap_alloc(sizeof(void*));
heap->blocks = malloc(sizeof(void*));
if(!heap->blocks)
return NULL;
}
tmp = heap_alloc(block_size(0));
tmp = malloc(block_size(0));
if(!tmp)
return NULL;
@ -93,12 +93,12 @@ void *heap_pool_alloc(heap_pool_t *heap, DWORD size)
if(size <= block_size(heap->last_block+1)) {
if(heap->last_block+1 == heap->block_cnt) {
tmp = heap_realloc(heap->blocks, (heap->block_cnt+1)*sizeof(void*));
tmp = realloc(heap->blocks, (heap->block_cnt+1)*sizeof(void*));
if(!tmp)
return NULL;
heap->blocks = tmp;
heap->blocks[heap->block_cnt] = heap_alloc(block_size(heap->block_cnt));
heap->blocks[heap->block_cnt] = malloc(block_size(heap->block_cnt));
if(!heap->blocks[heap->block_cnt])
return NULL;
@ -110,7 +110,7 @@ void *heap_pool_alloc(heap_pool_t *heap, DWORD size)
return heap->blocks[heap->last_block];
}
list = heap_alloc(size + sizeof(struct list));
list = malloc(size + sizeof(struct list));
if(!list)
return NULL;
@ -143,7 +143,7 @@ void heap_pool_clear(heap_pool_t *heap)
while((tmp = list_head(&heap->custom_blocks))) {
list_remove(tmp);
heap_free(tmp);
free(tmp);
}
if(WARN_ON(heap)) {
@ -164,8 +164,8 @@ void heap_pool_free(heap_pool_t *heap)
heap_pool_clear(heap);
for(i=0; i < heap->block_cnt; i++)
heap_free(heap->blocks[i]);
heap_free(heap->blocks);
free(heap->blocks[i]);
free(heap->blocks);
heap_pool_init(heap);
}
@ -190,7 +190,7 @@ void jsval_release(jsval_t val)
break;
case JSV_VARIANT:
VariantClear(get_variant(val));
heap_free(get_variant(val));
free(get_variant(val));
break;
default:
break;
@ -203,7 +203,7 @@ static HRESULT jsval_variant(jsval_t *val, VARIANT *var)
HRESULT hres;
__JSVAL_TYPE(*val) = JSV_VARIANT;
__JSVAL_VAR(*val) = v = heap_alloc(sizeof(VARIANT));
__JSVAL_VAR(*val) = v = malloc(sizeof(VARIANT));
if(!v) {
*val = jsval_undefined();
return E_OUTOFMEMORY;
@ -213,7 +213,7 @@ static HRESULT jsval_variant(jsval_t *val, VARIANT *var)
hres = VariantCopy(v, var);
if(FAILED(hres)) {
*val = jsval_undefined();
heap_free(v);
free(v);
}
return hres;
}
@ -1023,7 +1023,7 @@ static ULONG WINAPI JSCaller_Release(IServiceProvider *iface)
if(!ref) {
assert(!This->ctx);
heap_free(This);
free(This);
}
return ref;
@ -1056,7 +1056,7 @@ HRESULT create_jscaller(script_ctx_t *ctx)
{
JSCaller *ret;
ret = heap_alloc(sizeof(*ret));
ret = malloc(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;

View File

@ -820,10 +820,10 @@ void release_cc(cc_ctx_t *cc)
for(iter = cc->vars; iter; iter = next) {
next = iter->next;
heap_free(iter);
free(iter);
}
heap_free(cc);
free(cc);
}
static BOOL new_cc_var(cc_ctx_t *cc, const WCHAR *name, int len, ccval_t v)
@ -833,7 +833,7 @@ static BOOL new_cc_var(cc_ctx_t *cc, const WCHAR *name, int len, ccval_t v)
if(len == -1)
len = lstrlenW(name);
new_v = heap_alloc(sizeof(cc_var_t) + (len+1)*sizeof(WCHAR));
new_v = malloc(sizeof(cc_var_t) + (len+1)*sizeof(WCHAR));
if(!new_v)
return FALSE;
@ -864,7 +864,7 @@ static BOOL init_cc(parser_ctx_t *ctx)
if(ctx->script->cc)
return TRUE;
cc = heap_alloc(sizeof(cc_ctx_t));
cc = malloc(sizeof(cc_ctx_t));
if(!cc) {
lex_error(ctx, E_OUTOFMEMORY);
return FALSE;

View File

@ -519,13 +519,13 @@ HRESULT create_math(script_ctx_t *ctx, jsdisp_t **ret)
{L"SQRT2", M_SQRT2}, /* ECMA-262 3rd Edition 15.8.1.8 */
};
math = heap_alloc_zero(sizeof(jsdisp_t));
math = calloc(1, sizeof(jsdisp_t));
if(!math)
return E_OUTOFMEMORY;
hres = init_dispex_from_constr(math, ctx, &Math_info, ctx->object_constr);
if(FAILED(hres)) {
heap_free(math);
free(math);
return hres;
}

View File

@ -658,7 +658,7 @@ static HRESULT alloc_number(script_ctx_t *ctx, jsdisp_t *object_prototype, Numbe
NumberInstance *number;
HRESULT hres;
number = heap_alloc_zero(sizeof(NumberInstance));
number = calloc(1, sizeof(NumberInstance));
if(!number)
return E_OUTOFMEMORY;
@ -667,7 +667,7 @@ static HRESULT alloc_number(script_ctx_t *ctx, jsdisp_t *object_prototype, Numbe
else
hres = init_dispex_from_constr(&number->dispex, ctx, &NumberInst_info, ctx->number_constr);
if(FAILED(hres)) {
heap_free(number);
free(number);
return hres;
}

View File

@ -447,7 +447,7 @@ done:
static void Object_destructor(jsdisp_t *dispex)
{
heap_free(dispex);
free(dispex);
}
static const builtin_prop_t Object_props[] = {
@ -1137,13 +1137,13 @@ HRESULT create_object(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_t **ret)
jsdisp_t *object;
HRESULT hres;
object = heap_alloc_zero(sizeof(jsdisp_t));
object = calloc(1, sizeof(jsdisp_t));
if(!object)
return E_OUTOFMEMORY;
hres = init_dispex_from_constr(object, ctx, &ObjectInst_info, constr ? constr : ctx->object_constr);
if(FAILED(hres)) {
heap_free(object);
free(object);
return hres;
}

View File

@ -1604,7 +1604,7 @@ void parser_release(parser_ctx_t *ctx)
{
script_release(ctx->script);
heap_pool_free(&ctx->heap);
heap_free(ctx);
free(ctx);
}
HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, bytecode_t *code, const WCHAR *delimiter, BOOL from_eval,
@ -1614,7 +1614,7 @@ HRESULT script_parse(script_ctx_t *ctx, struct _compiler_ctx_t *compiler, byteco
heap_pool_t *mark;
HRESULT hres;
parser_ctx = heap_alloc_zero(sizeof(parser_ctx_t));
parser_ctx = calloc(1, sizeof(parser_ctx_t));
if(!parser_ctx)
return E_OUTOFMEMORY;

View File

@ -482,7 +482,7 @@ EmitREBytecode(CompilerState *state, regexp_t *re, size_t treeDepth,
if (treeDepth == 0) {
emitStateStack = NULL;
} else {
emitStateStack = heap_alloc(sizeof(EmitStateStackEntry) * treeDepth);
emitStateStack = malloc(sizeof(EmitStateStackEntry) * treeDepth);
if (!emitStateStack)
return NULL;
}
@ -788,7 +788,7 @@ EmitREBytecode(CompilerState *state, regexp_t *re, size_t treeDepth,
}
cleanup:
heap_free(emitStateStack);
free(emitStateStack);
return pc;
jump_too_big:
@ -1667,11 +1667,11 @@ ParseRegExp(CompilerState *state)
return (state->result != NULL);
}
operatorStack = heap_alloc(sizeof(REOpData) * operatorStackSize);
operatorStack = malloc(sizeof(REOpData) * operatorStackSize);
if (!operatorStack)
return FALSE;
operandStack = heap_alloc(sizeof(RENode *) * operandStackSize);
operandStack = malloc(sizeof(RENode *) * operandStackSize);
if (!operandStack)
goto out;
@ -1762,7 +1762,7 @@ pushOperand:
if (operandSP == operandStackSize) {
RENode **tmp;
operandStackSize += operandStackSize;
tmp = heap_realloc(operandStack, sizeof(RENode *) * operandStackSize);
tmp = realloc(operandStack, sizeof(RENode *) * operandStackSize);
if (!tmp)
goto out;
operandStack = tmp;
@ -1895,7 +1895,7 @@ pushOperator:
if (operatorSP == operatorStackSize) {
REOpData *tmp;
operatorStackSize += operatorStackSize;
tmp = heap_realloc(operatorStack, sizeof(REOpData) * operatorStackSize);
tmp = realloc(operatorStack, sizeof(REOpData) * operatorStackSize);
if (!tmp)
goto out;
operatorStack = tmp;
@ -1907,8 +1907,8 @@ pushOperator:
}
}
out:
heap_free(operatorStack);
heap_free(operandStack);
free(operatorStack);
free(operandStack);
return result;
}
@ -2111,7 +2111,7 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
assert(src[-1] == '[' && end[0] == ']');
byteLength = (charSet->length >> 3) + 1;
charSet->u.bits = heap_alloc(byteLength);
charSet->u.bits = malloc(byteLength);
if (!charSet->u.bits) {
JS_ReportOutOfMemory(gData->cx);
gData->ok = FALSE;
@ -3184,12 +3184,12 @@ void regexp_destroy(regexp_t *re)
UINT i;
for (i = 0; i < re->classCount; i++) {
if (re->classList[i].converted)
heap_free(re->classList[i].u.bits);
free(re->classList[i].u.bits);
re->classList[i].u.bits = NULL;
}
heap_free(re->classList);
free(re->classList);
}
heap_free(re);
free(re);
}
regexp_t* regexp_new(void *cx, heap_pool_t *pool, const WCHAR *str,
@ -3238,14 +3238,14 @@ regexp_t* regexp_new(void *cx, heap_pool_t *pool, const WCHAR *str,
goto out;
}
resize = offsetof(regexp_t, program) + state.progLength + 1;
re = heap_alloc(resize);
re = malloc(resize);
if (!re)
goto out;
assert(state.classBitmapsMem <= CLASS_BITMAPS_MEM_LIMIT);
re->classCount = state.classCount;
if (re->classCount) {
re->classList = heap_alloc(re->classCount * sizeof(RECharSet));
re->classList = malloc(re->classCount * sizeof(RECharSet));
if (!re->classList) {
regexp_destroy(re);
re = NULL;
@ -3272,7 +3272,7 @@ regexp_t* regexp_new(void *cx, heap_pool_t *pool, const WCHAR *str,
regexp_t *tmp;
assert((size_t)(endPC - re->program) < state.progLength + 1);
resize = offsetof(regexp_t, program) + (endPC - re->program);
tmp = heap_realloc(re, resize);
tmp = realloc(re, resize);
if (tmp)
re = tmp;
}

View File

@ -72,7 +72,7 @@ static inline match_state_t* alloc_match_state(regexp_t *regexp,
size_t size = offsetof(match_state_t, parens) + regexp->parenCount*sizeof(RECapture);
match_state_t *ret;
ret = pool ? heap_pool_alloc(pool, size) : heap_alloc(size);
ret = pool ? heap_pool_alloc(pool, size) : malloc(size);
if(!ret)
return NULL;

View File

@ -134,7 +134,7 @@ static void release_map_entry(struct jsval_map_entry *entry)
jsval_release(entry->key);
jsval_release(entry->value);
list_remove(&entry->list_entry);
heap_free(entry);
free(entry);
}
static void delete_map_entry(MapInstance *map, struct jsval_map_entry *entry)
@ -159,7 +159,7 @@ static HRESULT set_map_entry(MapInstance *map, jsval_t key, jsval_t value, jsval
jsval_release(entry->value);
entry->value = val;
}else {
if(!(entry = heap_alloc_zero(sizeof(*entry)))) return E_OUTOFMEMORY;
if(!(entry = calloc(1, sizeof(*entry)))) return E_OUTOFMEMORY;
hres = jsval_copy(key, &entry->key);
if(SUCCEEDED(hres)) {
@ -168,7 +168,7 @@ static HRESULT set_map_entry(MapInstance *map, jsval_t key, jsval_t value, jsval
jsval_release(entry->key);
}
if(FAILED(hres)) {
heap_free(entry);
free(entry);
return hres;
}
grab_map_entry(entry);
@ -366,7 +366,7 @@ static void Map_destructor(jsdisp_t *dispex)
release_map_entry(entry);
}
heap_free(map);
free(map);
}
static const builtin_prop_t Map_prototype_props[] = {
{L"clear", Map_clear, PROPF_METHOD},
@ -411,7 +411,7 @@ static HRESULT Map_constructor(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns
if(!r)
return S_OK;
if(!(map = heap_alloc_zero(sizeof(*map))))
if(!(map = calloc(1, sizeof(*map))))
return E_OUTOFMEMORY;
hres = init_dispex(&map->dispex, ctx, &Map_info, ctx->map_prototype);
@ -563,7 +563,7 @@ static HRESULT Set_constructor(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns
if(!r)
return S_OK;
if(!(set = heap_alloc_zero(sizeof(*set))))
if(!(set = calloc(1, sizeof(*set))))
return E_OUTOFMEMORY;
hres = init_dispex(&set->dispex, ctx, &Set_info, ctx->set_prototype);

View File

@ -362,7 +362,7 @@ static HRESULT String_concat(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig
jsstr_t **strs;
WCHAR *ptr;
strs = heap_alloc_zero(str_cnt * sizeof(*strs));
strs = calloc(str_cnt, sizeof(*strs));
if(!strs) {
jsstr_release(str);
return E_OUTOFMEMORY;
@ -397,7 +397,7 @@ static HRESULT String_concat(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig
while(i--)
jsstr_release(strs[i]);
heap_free(strs);
free(strs);
if(FAILED(hres))
return hres;
}
@ -628,9 +628,9 @@ static BOOL strbuf_ensure_size(strbuf_t *buf, unsigned len)
if(new_size < len)
new_size = len;
if(buf->buf)
new_buf = heap_realloc(buf->buf, new_size*sizeof(WCHAR));
new_buf = realloc(buf->buf, new_size*sizeof(WCHAR));
else
new_buf = heap_alloc(new_size*sizeof(WCHAR));
new_buf = malloc(new_size*sizeof(WCHAR));
if(!new_buf)
return FALSE;
@ -673,7 +673,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func,
HRESULT hres = S_OK;
argc = match->paren_count+3;
argv = heap_alloc_zero(sizeof(*argv)*argc);
argv = calloc(argc, sizeof(*argv));
if(!argv)
return E_OUTOFMEMORY;
@ -706,7 +706,7 @@ static HRESULT rep_call(script_ctx_t *ctx, jsdisp_t *func,
for(i=0; i <= match->paren_count; i++)
jsstr_release(get_string(argv[i]));
heap_free(argv);
free(argv);
if(FAILED(hres))
return hres;
@ -909,7 +909,7 @@ static HRESULT String_replace(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi
if(match_str)
jsstr_release(match_jsstr);
if(regexp)
heap_free(match);
free(match);
if(SUCCEEDED(hres) && last_match.cp && regexp) {
jsstr_release(ctx->last_match);
@ -933,7 +933,7 @@ static HRESULT String_replace(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi
*r = jsval_string(ret_str);
}
heap_free(ret.buf);
free(ret.buf);
return hres;
}
@ -1500,7 +1500,7 @@ static void String_destructor(jsdisp_t *dispex)
StringInstance *This = string_from_jsdisp(dispex);
jsstr_release(This->str);
heap_free(This);
free(This);
}
static unsigned String_idx_length(jsdisp_t *jsdisp)
@ -1681,7 +1681,7 @@ static HRESULT string_alloc(script_ctx_t *ctx, jsdisp_t *object_prototype, jsstr
StringInstance *string;
HRESULT hres;
string = heap_alloc_zero(sizeof(StringInstance));
string = calloc(1, sizeof(StringInstance));
if(!string)
return E_OUTOFMEMORY;
@ -1690,7 +1690,7 @@ static HRESULT string_alloc(script_ctx_t *ctx, jsdisp_t *object_prototype, jsstr
else
hres = init_dispex_from_constr(&string->dispex, ctx, &StringInst_info, ctx->string_constr);
if(FAILED(hres)) {
heap_free(string);
free(string);
return hres;
}

View File

@ -73,20 +73,20 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, jsval_t vthis, WORD flags, uns
if(argc < SafeArrayGetDim(vbarray->safearray))
return JS_E_SUBSCRIPT_OUT_OF_RANGE;
indexes = heap_alloc(sizeof(indexes[0])*argc);
indexes = malloc(sizeof(indexes[0])*argc);
if(!indexes)
return E_OUTOFMEMORY;
for(i=0; i<argc; i++) {
hres = to_long(ctx, argv[i], indexes + i);
if(FAILED(hres)) {
heap_free(indexes);
free(indexes);
return hres;
}
}
hres = SafeArrayGetElement(vbarray->safearray, indexes, (void*)&out);
heap_free(indexes);
free(indexes);
if(hres == DISP_E_BADINDEX)
return JS_E_SUBSCRIPT_OUT_OF_RANGE;
else if(FAILED(hres))
@ -235,7 +235,7 @@ static void VBArray_destructor(jsdisp_t *dispex)
VBArrayInstance *vbarray = vbarray_from_jsdisp(dispex);
SafeArrayDestroy(vbarray->safearray);
heap_free(vbarray);
free(vbarray);
}
static const builtin_prop_t VBArray_props[] = {
@ -260,7 +260,7 @@ static HRESULT alloc_vbarray(script_ctx_t *ctx, jsdisp_t *object_prototype, VBAr
VBArrayInstance *vbarray;
HRESULT hres;
vbarray = heap_alloc_zero(sizeof(VBArrayInstance));
vbarray = calloc(1, sizeof(VBArrayInstance));
if(!vbarray)
return E_OUTOFMEMORY;
@ -270,7 +270,7 @@ static HRESULT alloc_vbarray(script_ctx_t *ctx, jsdisp_t *object_prototype, VBAr
hres = init_dispex_from_constr(&vbarray->dispex, ctx, &VBArray_info, ctx->vbarray_constr);
if(FAILED(hres)) {
heap_free(vbarray);
free(vbarray);
return hres;
}