mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-06-15 09:39:13 +00:00
Reset members of jit block/value stack after destroy (#1048)
After `jit_value_stack_destory()`, the `JitValue` pointed by `value_list_head` and `value_list_end` are freed and still keep the value. So, when `jit_value_stack_push()` is called, for example, `load_block_params()` after `jit_value_stack_destroy()` in `handle_op_else()`, `value_stack` will not be treated like an empty one, and new `JitValue` will be appended to `value_list_end`, which is a dangling pointer(pointer to the freed `JitValue`).
This commit is contained in:
parent
eb518c0423
commit
9fd3d53bc9
|
@ -1330,6 +1330,9 @@ jit_value_stack_destroy(JitValueStack *stack)
|
|||
jit_free(value);
|
||||
value = p;
|
||||
}
|
||||
|
||||
stack->value_list_head = NULL;
|
||||
stack->value_list_end = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1373,6 +1376,9 @@ jit_block_stack_destroy(JitBlockStack *stack)
|
|||
jit_block_destroy(block);
|
||||
block = p;
|
||||
}
|
||||
|
||||
stack->block_list_head = NULL;
|
||||
stack->block_list_end = NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
Loading…
Reference in New Issue
Block a user