1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

wasm: fix the memory leak: wasm_buf

wasm: fix the memory leak: wasm_buf

Signed-off-by: zengwei zengwei1@uniontech.com
This commit is contained in:
zengwei2000 2023-12-20 23:37:28 +08:00 committed by GitHub
parent 724e6e0098
commit 4edfd85286
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
@ -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;