-
Notifications
You must be signed in to change notification settings - Fork 628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iwasm: fix native lib cleanup after error #2443
Conversation
* if something failed after calling init_native_lib, call deinit_native_lib to clean up. * restructure the relevant code for better maintainability.
product-mini/platforms/posix/main.c
Outdated
struct native_lib * | ||
load_native_lib(const char *name) | ||
{ | ||
struct native_lib *lib = malloc(sizeof(*lib)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using wasm_runtime_malloc/wasm_runtime_free to be consistent with other places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes sense. i will change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
product-mini/platforms/posix/main.c
Outdated
} | ||
free(lib); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use wasm_runtime_free.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops. fixed. thank you.
bf05525
to
61eac4f
Compare
- If something failed after calling init_native_lib, call deinit_native_lib to clean up. - Restructure the relevant code for better maintainability.
if something failed after calling init_native_lib, call deinit_native_lib to clean up.
restructure the relevant code for better maintainability.