Skip to content

Commit 858d1dd

Browse files
authored
Fix duplicate vector init in wasm_module_validate (#2498)
1 parent 377c3d7 commit 858d1dd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

core/iwasm/common/wasm_c_api.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,12 +2303,11 @@ wasm_module_validate(wasm_store_t *store, const wasm_byte_vec_t *binary)
23032303
}
23042304

23052305
/* make a copy of binary */
2306-
wasm_byte_vec_new_uninitialized(&local_binary, binary->size);
2306+
wasm_byte_vec_copy(&local_binary, binary);
2307+
23072308
if (binary->size && !local_binary.data)
23082309
return false;
23092310

2310-
wasm_byte_vec_copy(&local_binary, binary);
2311-
23122311
module_rt = wasm_runtime_load((uint8 *)local_binary.data,
23132312
(uint32)local_binary.size, error_buf, 128);
23142313
wasm_byte_vec_delete(&local_binary);

0 commit comments

Comments
 (0)