From 903a27aff208200311118d41952ad526a68815aa Mon Sep 17 00:00:00 2001 From: Wenyong Huang Date: Wed, 24 Aug 2022 22:00:16 +0800 Subject: [PATCH] Fix fast jit destroy block issue (#1412) Only destroy the block if it hasn't been pushed into the block stack, or it will be destroyed again when destroying the block stack. --- core/iwasm/fast-jit/fe/jit_emit_control.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/iwasm/fast-jit/fe/jit_emit_control.c b/core/iwasm/fast-jit/fe/jit_emit_control.c index e9200e78..eafce674 100644 --- a/core/iwasm/fast-jit/fe/jit_emit_control.c +++ b/core/iwasm/fast-jit/fe/jit_emit_control.c @@ -807,7 +807,11 @@ jit_compile_op_block(JitCompContext *cc, uint8 **p_frame_ip, return true; fail: - jit_block_destroy(block); + /* Only destroy the block if it hasn't been pushed into + the block stack, or if will be destroyed again when + destroying the block stack */ + if (jit_block_stack_top(&cc->block_stack) != block) + jit_block_destroy(block); return false; }