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
Fix Alloc-Dealloc mismatches #1943
base: master
Are you sure you want to change the base?
Conversation
for (uint32_t i = 0; i < tempArray->Length(); ++i) { | ||
auto conversionResult = Configurable{{ arg.arrayElementCppClassName }}::fromJavascript( | ||
nodegitContext, | ||
Nan::Get(tempArray, i).ToLocalChecked() | ||
); | ||
|
||
if (!conversionResult.result) { | ||
delete[] baton->{{ arg.name }}; | ||
// TODO free previously allocated memory |
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.
Does this still need to be handled?
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.
@julianmesa-gitkraken this comment came from you.
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.
Yes but I will do it in another PR. I need to store all allocated memory in a map, then if I get an error reading javascript arguments we have to release all allocated memory, then throw the error.
42da6a6
to
af08eb9
Compare
An Alloc-Dealloc Mismatch causes undefined behavior. Kind of a minor problem but should be fixed nonetheless.
for more details
https://stackoverflow.com/a/10854437/4776273