]> git.kaiwu.me - quickjs.git/commitdiff
fixed error handling in os.exec() (#503)
authorFabrice Bellard <fabrice@bellard.org>
Thu, 14 May 2026 13:51:22 +0000 (15:51 +0200)
committerFabrice Bellard <fabrice@bellard.org>
Thu, 14 May 2026 14:39:41 +0000 (16:39 +0200)
quickjs-libc.c

index 99ba96fc5d58de52cbc0942ca6697f74303a0fd9..84f990d94ac4f9fb4146eef01264813d19030c8e 100644 (file)
@@ -3309,7 +3309,7 @@ static JSValue js_os_exec(JSContext *ctx, JSValueConst this_val,
     for(i = 0; i < exec_argc; i++)
         JS_FreeCString(ctx, exec_argv[i]);
     js_free(ctx, exec_argv);
-    if (envp != environ) {
+    if (envp && envp != environ) {
         char **p;
         p = envp;
         while (*p != NULL) {