Skip to content

Commit 23e21ab

Browse files
committed
fix leaks
1 parent 8851ff1 commit 23e21ab

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

qjs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,21 +653,25 @@ int main(int argc, char **argv)
653653
if (JS_IsException(ns))
654654
goto fail;
655655
JSValue func = JS_GetPropertyStr(ctx, ns, "runStandalone");
656+
JS_FreeValue(ctx, ns);
656657
if (JS_IsException(ns))
657658
goto fail;
658659
ret = JS_Call(ctx, func, JS_UNDEFINED, 0, NULL);
660+
JS_FreeValue(ctx, func);
659661
} else if (compile_file) {
660662
JSValue ns = load_standalone_module(ctx);
661663
if (JS_IsException(ns))
662664
goto fail;
663665
JSValue func = JS_GetPropertyStr(ctx, ns, "compileStandalone");
666+
JS_FreeValue(ctx, ns);
664667
if (JS_IsException(ns))
665668
goto fail;
666669
JSValue args[3];
667670
args[0] = JS_NewString(ctx, compile_file);
668671
args[1] = JS_NewString(ctx, out);
669672
args[2] = JS_NewString(ctx, exe != NULL ? exe : argv[0]);
670673
ret = JS_Call(ctx, func, JS_UNDEFINED, countof(args), args);
674+
JS_FreeValue(ctx, func);
671675
JS_FreeValue(ctx, args[0]);
672676
JS_FreeValue(ctx, args[1]);
673677
JS_FreeValue(ctx, args[2]);

0 commit comments

Comments
 (0)