summaryrefslogtreecommitdiff
path: root/src/wasm-binary-reader-interpreter.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-binary-reader-interpreter.c')
-rw-r--r--src/wasm-binary-reader-interpreter.c8
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) {