wasm-micro-runtime icon indicating copy to clipboard operation
wasm-micro-runtime copied to clipboard

wasm_runtime_common.c `cp` might not be freed

Open linear0211 opened this issue 2 months ago • 4 comments

https://github.com/bytecodealliance/wasm-micro-runtime/blob/3bf08a0eda39d97324dac99fff087012bf0407bf/core/iwasm/common/wasm_runtime_common.c#L3814-L3843

It seems that cp is not freed in some failure paths. Please check whether this observation is correct.

linear0211 avatar Oct 21 '25 06:10 linear0211

Please check whether this observation is correct.

i think you are correct.

also, strtok should not be used in the library as it isn't thread-safe.

yamt avatar Oct 23 '25 03:10 yamt

So maybe it's a good idea to replace strtok with strtok_r?

TianlongLiang avatar Oct 23 '25 05:10 TianlongLiang

So maybe it's a good idea to replace strtok with strtok_r?

it's a possible solution, yes.

yamt avatar Oct 23 '25 07:10 yamt

So maybe it's a good idea to replace strtok with strtok_r?

it's a possible solution, yes.

Thank you for the feedback. I found this while working on PR #4619, so I’ll fix it there together.

linear0211 avatar Oct 24 '25 13:10 linear0211