From: Dmitry Volyntsev Date: Tue, 17 Nov 2026 01:10:02 +0000 (-0800) Subject: QuickJS: fix rejection reason leak in qjs_promise_result() X-Git-Url: https://git.kaiwu.me/http/%7B@url%7D?a=commitdiff_plain;h=302a55d106fa2a5df46f57232de84b54d12b7203;p=njs.git QuickJS: fix rejection reason leak in qjs_promise_result() Previously, when JS_EnqueueJob() failed, the cleanup freed the original result argument instead of the job arguments. For a rejected result, that argument is JS_EXCEPTION, while the reason taken with JS_GetException() leaked. Free the job arguments, which own the callback and the reason or result value in both cases. The issue was introduced in 87086636 (0.8.10). --- diff --git a/src/qjs.c b/src/qjs.c index f2ac6dde..99a732d1 100644 --- a/src/qjs.c +++ b/src/qjs.c @@ -1637,8 +1637,8 @@ qjs_promise_result(JSContext *cx, JSValue result) if (JS_EnqueueJob(cx, qjs_promise_fill_trampoline, 2, arguments) < 0) { JS_FreeValue(cx, promise); - JS_FreeValue(cx, callbacks[is_error]); - JS_FreeValue(cx, result); + JS_FreeValue(cx, arguments[0]); + JS_FreeValue(cx, arguments[1]); return JS_EXCEPTION; }