fix(runtime-core) Drop vm::FuncCtx if not null.

This commit is contained in:
Ivan Enderlin
2020-01-09 15:11:25 +01:00
parent 19c3837881
commit 6018aa32e1

View File

@ -563,10 +563,12 @@ impl Drop for ImportBacking {
fn drop(&mut self) {
// Properly drop the `vm::FuncCtx` in `vm::ImportedFunc`.
for (_imported_func_index, imported_func) in (*self.vm_functions).iter_mut() {
if !imported_func.func_ctx.as_ptr().is_null() {
let _: Box<vm::FuncCtx> = unsafe { Box::from_raw(imported_func.func_ctx.as_ptr()) };
}
}
}
}
fn import_functions(
module: &ModuleInner,