summaryrefslogtreecommitdiff
path: root/src/binary-reader-ast.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/binary-reader-ast.c')
-rw-r--r--src/binary-reader-ast.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/binary-reader-ast.c b/src/binary-reader-ast.c
index e82b82c2..68c49be7 100644
--- a/src/binary-reader-ast.c
+++ b/src/binary-reader-ast.c
@@ -1163,5 +1163,7 @@ WasmResult wasm_read_binary_ast(struct WasmAllocator* allocator,
WasmResult result =
wasm_read_binary(allocator, data, size, &reader, 1, options);
WASM_DESTROY_VECTOR_AND_ELEMENTS(allocator, ctx.label_stack, label_node);
+ if (WASM_FAILED(result))
+ wasm_destroy_module(allocator, out_module);
return result;
}