]> git.kaiwu.me - njs.git/commit
Modules: fix subrequest response body leak in QuickJS
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 30 Oct 2026 01:39:31 +0000 (18:39 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Mon, 2 Nov 2026 14:42:35 +0000 (06:42 -0800)
commit604ba7f9cd1b2ef2115259cb0564d449b37c7e38
tree492a1c0212dd79560a8a34597ed066c2d64779b7
parentefce2469de8b784ed6497b20cfac10236e107884
Modules: fix subrequest response body leak in QuickJS

Previously, alternating r.responseText and r.responseBuffer on a
subrequest reply overwrote the cached req->response_body value
without freeing it.  The value stayed referenced until the runtime
was freed, triggering the "list_empty(&rt->gc_obj_list)" assertion
in JS_FreeRuntime() in debug builds and accumulating in the runtime
with js_context_reuse.

The fix is to free the cached value before replacing it, as is
already done for r.requestText and r.requestBuffer.

The issue was introduced in 201b1276 (0.8.6).
nginx/ngx_http_js_module.c
nginx/t/js_subrequests.t