diff options
author | Ben Smith <binji@chromium.org> | 2016-04-27 17:09:37 -0700 |
---|---|---|
committer | Ben Smith <binji@chromium.org> | 2016-04-27 17:10:09 -0700 |
commit | 5ccfea1eff9dd9fb71e70479216e1f478429f9be (patch) | |
tree | 2b56498b9eefc3a858e3c07a24342df7aa5a1ed1 | |
parent | c4e0efa14686e4862e95449786dda75c96baed93 (diff) | |
download | wabt-5ccfea1eff9dd9fb71e70479216e1f478429f9be.tar.gz wabt-5ccfea1eff9dd9fb71e70479216e1f478429f9be.tar.bz2 wabt-5ccfea1eff9dd9fb71e70479216e1f478429f9be.zip |
fix memory leak in interpreter
It looks like this started showing up because of my refactoring in the
last CL.
-rw-r--r-- | src/wasm-binary-reader-interpreter.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wasm-binary-reader-interpreter.c b/src/wasm-binary-reader-interpreter.c index de18f6dd..d45e2742 100644 --- a/src/wasm-binary-reader-interpreter.c +++ b/src/wasm-binary-reader-interpreter.c @@ -473,8 +473,14 @@ static void pop_depth(WasmContext* ctx) { ctx->depth_stack.size--; /* reduce the depth_fixups stack as well, but it may be smaller than * depth_stack so only do it conditionally. */ - if (ctx->depth_fixups.size > ctx->depth_stack.size) + if (ctx->depth_fixups.size > ctx->depth_stack.size) { + uint32_t from = ctx->depth_stack.size; + uint32_t to = ctx->depth_fixups.size; + uint32_t i; + for (i = from; i < to; ++i) + wasm_destroy_uint32_vector(ctx->allocator, &ctx->depth_fixups.data[i]); ctx->depth_fixups.size = ctx->depth_stack.size; + } } static uint32_t translate_depth(WasmContext* ctx, uint32_t depth) { |