Skip to content

Commit

Permalink
wasm: fix the memory leak: wasm_buf
Browse files Browse the repository at this point in the history
wasm: fix the memory leak: wasm_buf

Signed-off-by: zengwei zengwei1@uniontech.com
  • Loading branch information
zengwei00 authored Dec 20, 2023
1 parent 724e6e0 commit 4edfd85
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/wasm/iwasmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ int wamr_run_cp(const void *bytecode, size_t bytecode_len, int argc, char *argv[
if (argc > 0) {
parv = malloc(sizeof(argv[0]) * argc);
if (!parv){
free(wasm_buf);
return -1;
}
memcpy(parv, argv, sizeof(argv[0]) * argc);
Expand All @@ -130,6 +131,7 @@ int wamr_run_cp(const void *bytecode, size_t bytecode_len, int argc, char *argv[
argc = 1;
parv = malloc(sizeof(argv[0]) * argc);
if (!parv) {
free(wasm_buf);
return -1;
}
parv[0] = empty;
Expand Down

0 comments on commit 4edfd85

Please sign in to comment.