Skip to content

Commit

Permalink
Merge #1912
Browse files Browse the repository at this point in the history
1912: fix: Fix test_set_host_global_immutable test r=Hywan a=jubianchi

wasm_globaltype_new take ownership of its first argument, valtype. The test was freeing the valtype when it should not


Co-authored-by: jubianchi <julien@wasmer.io>
  • Loading branch information
bors[bot] and jubianchi authored Dec 10, 2020
2 parents 217601a + 044388e commit 0d2396b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/c-api/src/wasm_c_api/externals/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,17 @@ mod tests {
wasm_val_t forty_two = WASM_F32_VAL(42);
wasm_val_t forty_three = WASM_F32_VAL(43);

wasm_valtype_t* type = wasm_valtype_new_i32();
wasm_globaltype_t* global_type = wasm_globaltype_new(type, WASM_CONST);
wasm_valtype_t* valtype = wasm_valtype_new_i32();
wasm_globaltype_t* global_type = wasm_globaltype_new(valtype, WASM_CONST);
wasm_global_t* global = wasm_global_new(store, global_type, &forty_two);

wasm_globaltype_delete(global_type);

wasm_global_set(global, &forty_three);

assert(wasmer_last_error_length() > 0);

wasm_globaltype_delete(global_type);
wasm_valtype_delete(type);
wasm_global_delete(global);
wasm_store_delete(store);
wasm_engine_delete(engine);

Expand Down

0 comments on commit 0d2396b

Please sign in to comment.