Skip to content

Commit

Permalink
fix leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
saghul committed Dec 3, 2024
1 parent 8851ff1 commit 23e21ab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,21 +653,25 @@ int main(int argc, char **argv)
if (JS_IsException(ns))
goto fail;
JSValue func = JS_GetPropertyStr(ctx, ns, "runStandalone");
JS_FreeValue(ctx, ns);
if (JS_IsException(ns))
goto fail;
ret = JS_Call(ctx, func, JS_UNDEFINED, 0, NULL);
JS_FreeValue(ctx, func);
} else if (compile_file) {
JSValue ns = load_standalone_module(ctx);
if (JS_IsException(ns))
goto fail;
JSValue func = JS_GetPropertyStr(ctx, ns, "compileStandalone");
JS_FreeValue(ctx, ns);
if (JS_IsException(ns))
goto fail;
JSValue args[3];
args[0] = JS_NewString(ctx, compile_file);
args[1] = JS_NewString(ctx, out);
args[2] = JS_NewString(ctx, exe != NULL ? exe : argv[0]);
ret = JS_Call(ctx, func, JS_UNDEFINED, countof(args), args);
JS_FreeValue(ctx, func);
JS_FreeValue(ctx, args[0]);
JS_FreeValue(ctx, args[1]);
JS_FreeValue(ctx, args[2]);
Expand Down

0 comments on commit 23e21ab

Please sign in to comment.