mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 05:08:19 +00:00
feat(c-api) Shrink vector of traps.
Ensure that the size of the vector of the instance's traps equals its capacity by shrinking it.
This commit is contained in:
@@ -45,6 +45,7 @@ pub unsafe extern "C" fn wasm_instance_new(
|
||||
let trap: Box<wasm_trap_t> = Box::new(runtime_error.into());
|
||||
let mut traps: Vec<*mut wasm_trap_t> = Vec::with_capacity(1);
|
||||
traps.push(Box::into_raw(trap));
|
||||
traps.shrink_to_fit();
|
||||
|
||||
let pointer = traps.as_mut_ptr();
|
||||
mem::forget(traps);
|
||||
|
||||
Reference in New Issue
Block a user