diff options
author | Ben Smith <binjimin@gmail.com> | 2017-03-06 11:34:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-06 11:34:37 -0800 |
commit | e4dda12b17a5323a56b6782a6787f258ed2d8c81 (patch) | |
tree | c47e34928fc9b48f5b8dd1579e4c0213074b6494 /src/binary-reader-ast.cc | |
parent | b6e5735f3bfbb66d76142fc2f404da796289fc76 (diff) | |
download | wabt-e4dda12b17a5323a56b6782a6787f258ed2d8c81.tar.gz wabt-e4dda12b17a5323a56b6782a6787f258ed2d8c81.tar.bz2 wabt-e4dda12b17a5323a56b6782a6787f258ed2d8c81.zip |
Use new/delete instead of malloc/free (#332)
Also switch some void* -> char*, because it removes some unnecessary
casts. C++ does not like void*.
Diffstat (limited to 'src/binary-reader-ast.cc')
-rw-r--r-- | src/binary-reader-ast.cc | 4 |
1 files changed, 2 insertions, 2 deletions
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<Context*>(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; |