From: Dmitry Volyntsev Date: Fri, 12 Jun 2026 00:06:32 +0000 (-0700) Subject: Fetch: fix missing event cleanup when resolver start fails X-Git-Tag: 1.0.0~13 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/static/gitweb.js?a=commitdiff_plain;h=0365e3ad0d822c8d49d58a324b46cb15aa99195c;p=njs.git Fetch: fix missing event cleanup when resolver start fails Previously, when the resolver context allocation failed, both engines returned without deleting the registered fetch event and reported the error with a synchronous throw instead of rejecting the returned promise, unlike all other failure paths. --- diff --git a/nginx/ngx_js_fetch.c b/nginx/ngx_js_fetch.c index 145617f0..554f14f4 100644 --- a/nginx/ngx_js_fetch.c +++ b/nginx/ngx_js_fetch.c @@ -645,7 +645,7 @@ ngx_js_ext_fetch(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, if (ctx == NULL) { njs_vm_memory_error(vm); - return NJS_ERROR; + goto fail; } if (ctx == NGX_NO_RESOLVER) { diff --git a/nginx/ngx_qjs_fetch.c b/nginx/ngx_qjs_fetch.c index 535773bc..693fb48d 100644 --- a/nginx/ngx_qjs_fetch.c +++ b/nginx/ngx_qjs_fetch.c @@ -385,8 +385,8 @@ ngx_qjs_ext_fetch(JSContext *cx, JSValueConst this_val, int argc, ngx_qjs_external_resolver_timeout(cx, external)); if (rs == NULL) { - JS_FreeValue(cx, promise); - return JS_ThrowOutOfMemory(cx); + JS_ThrowOutOfMemory(cx); + goto fail; } if (rs == NGX_NO_RESOLVER) {