From e4dda12b17a5323a56b6782a6787f258ed2d8c81 Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Mon, 6 Mar 2017 11:34:37 -0800 Subject: Use new/delete instead of malloc/free (#332) Also switch some void* -> char*, because it removes some unnecessary casts. C++ does not like void*. --- src/binary-reader-ast.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/binary-reader-ast.cc') diff --git a/src/binary-reader-ast.cc b/src/binary-reader-ast.cc index 999e122e..f8cd20c9 100644 --- a/src/binary-reader-ast.cc +++ b/src/binary-reader-ast.cc @@ -105,7 +105,7 @@ static void dup_name(Context* ctx, StringSlice* name, StringSlice* out_name) { static Result append_expr(Context* ctx, Expr* expr) { LabelNode* label; if (WABT_FAILED(top_label(ctx, &label))) { - wabt_free(expr); + delete expr; return Result::Error; } if (*label->first) { @@ -873,7 +873,7 @@ static Result on_data_segment_data(uint32_t index, Context* ctx = static_cast(user_data); assert(index == ctx->module->data_segments.size - 1); DataSegment* segment = ctx->module->data_segments.data[index]; - segment->data = wabt_alloc(size); + segment->data = new char[size]; segment->size = size; memcpy(segment->data, data, size); return Result::Ok; -- cgit v1.2.3