Skip to content

Commit 0d2396b

Browse files
bors[bot]jubianchi
andauthored
Merge #1912
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 <[email protected]>
2 parents 217601a + 044388e commit 0d2396b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/c-api/src/wasm_c_api/externals/global.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,17 @@ mod tests {
9595
wasm_val_t forty_two = WASM_F32_VAL(42);
9696
wasm_val_t forty_three = WASM_F32_VAL(43);
9797

98-
wasm_valtype_t* type = wasm_valtype_new_i32();
99-
wasm_globaltype_t* global_type = wasm_globaltype_new(type, WASM_CONST);
98+
wasm_valtype_t* valtype = wasm_valtype_new_i32();
99+
wasm_globaltype_t* global_type = wasm_globaltype_new(valtype, WASM_CONST);
100100
wasm_global_t* global = wasm_global_new(store, global_type, &forty_two);
101101

102+
wasm_globaltype_delete(global_type);
103+
102104
wasm_global_set(global, &forty_three);
103105

104106
assert(wasmer_last_error_length() > 0);
105107

106-
wasm_globaltype_delete(global_type);
107-
wasm_valtype_delete(type);
108+
wasm_global_delete(global);
108109
wasm_store_delete(store);
109110
wasm_engine_delete(engine);
110111

0 commit comments

Comments
 (0)