]> git.kaiwu.me - quickjs.git/commitdiff
removed memory leak (#441)
authorFabrice Bellard <fabrice@bellard.org>
Thu, 18 Sep 2025 08:42:13 +0000 (10:42 +0200)
committerFabrice Bellard <fabrice@bellard.org>
Thu, 18 Sep 2025 08:42:13 +0000 (10:42 +0200)
quickjs.c

index 00043838afe2569963bd0d004d0c0c3286c3e263..9b997f6b9655af554f61d72b55b122db8ac1bef3 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -40802,8 +40802,10 @@ done:
             goto exception;
         args[0] = ret;
         res = JS_Invoke(ctx, arr, JS_ATOM_set, 1, args);
-        if (check_exception_free(ctx, res))
+        if (check_exception_free(ctx, res)) {
+            JS_FreeValue(ctx, arr);
             goto exception;
+        }
         JS_FreeValue(ctx, ret);
         ret = arr;
     }