File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
generate/templates/partials Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,9 @@ NAN_METHOD({{ cppClassName }}::{{ cppFunctionName }}) {
6464 );
6565
6666 if (!conversionResult.result ) {
67- delete[] baton->{{ arg.name }};
67+ // TODO free previously allocated memory
68+ free (baton->{{ arg.name }});
69+ delete baton;
6870 return Nan::ThrowError (Nan::New (conversionResult.error ).ToLocalChecked ());
6971 }
7072
@@ -77,6 +79,7 @@ NAN_METHOD({{ cppClassName }}::{{ cppFunctionName }}) {
7779 {
7880 auto conversionResult = Configurable{{ arg.cppClassName }}::fromJavascript (nodegitContext, info[{{ arg.jsArg }}]);
7981 if (!conversionResult.result ) {
82+ delete baton;
8083 return Nan::ThrowError (Nan::New (conversionResult.error ).ToLocalChecked ());
8184 }
8285
Original file line number Diff line number Diff line change 6060 Nan::Utf8String oidString (Nan::To<v8::String>(arrayVal).ToLocalChecked ());
6161 string str = string (*oidString);
6262 if (git_oid_fromstr (&from_{{ name }}[i], str.c_str ()) != GIT_OK) {
63+ delete baton;
6364 if (git_error_last ()) {
6465 return Nan::ThrowError (git_error_last ()->message );
6566 } else {
9394 string str = string (*oidString);
9495 if (git_oid_fromstr (oidOut, str.c_str ()) != GIT_OK) {
9596 free (oidOut);
97+ delete baton;
9698
9799 if (git_error_last ()) {
98100 return Nan::ThrowError (git_error_last ()->message );
You can’t perform that action at this time.
0 commit comments