Skip to content

Commit

Permalink
free all the allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Sep 16, 2023
1 parent 36a0951 commit af16ad4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Source/Modules/emit.cxx
Expand Up @@ -424,27 +424,34 @@ String* emit_action(Node *n) {
String *preaction = Getattr(action, "preaction");
if (preaction) {
Append(code, preaction);
Delete(preaction);
}

String *try_stmt = Getattr(action, "try");
if (try_stmt) {
Append(code, Getattr(action, "try"));
Delete(try_stmt);
}

Append(code, Getattr(action, "action"));
Delete(Getattr(action, "action"));

String *catch_stmt = Getattr(action, "catch");
if (catch_stmt) {
Append(code, Getattr(action, "catch"));
Delete(catch_stmt);
}

String *postaction = Getattr(action, "postaction");
if (postaction) {
Append(code, postaction);
Delete(postaction);
}

String *result = NewStringEmpty();
emit_action_code(n, result, code);
Delete(action);
Delete(code);
return result;
}

Expand Down
6 changes: 6 additions & 0 deletions Source/Modules/javascript.cxx
Expand Up @@ -3095,9 +3095,15 @@ int NAPIEmitter::emitFunctionDefinition(Node *n, bool is_member, bool is_static,

DelWrapper(wrapper);
Delete(input);
Delete(Getattr(action, "preaction"));
Delete(Getattr(action, "try"));
Delete(Getattr(action, "action"));
Delete(Getattr(action, "catch"));
Delete(Getattr(action, "postaction"));
Delete(action);
Delete(output);
Delete(jsasyncworker);
Delete(rethrow);

return SWIG_OK;
}
Expand Down

0 comments on commit af16ad4

Please sign in to comment.