]> git.kaiwu.me - njs.git/commit
QuickJS: fix XML value leaks in "in" checks
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 25 Sep 2026 01:33:48 +0000 (18:33 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Tue, 29 Sep 2026 20:48:28 +0000 (13:48 -0700)
commit9f6518fc35d166a3cc41d0182a151baadc8ab920
tree837407bf175e4c4728f4c641e8500db8c19223f2
parente9b1747f26cfdf2bd9b3e09bc5aba0f46e602ac3
QuickJS: fix XML value leaks in "in" checks

Previously, property existence checks such as "'$attr$a' in node",
"'to' in node", or "'$tags$to' in node" created the property value and
never released it when no property descriptor was requested.  A leaked
XMLNode also held a reference to its document, so the whole document
was never freed.

Also, qjs_xml_node_make() and qjs_xml_attr_make() incremented the
document reference count before creating the object, so a failed
JS_NewObjectClass() left the document permanently referenced.

The fix is to free the value when no descriptor is requested and to
take the document reference only after the object is created.
external/qjs_xml_module.c
test/xml/xml.t.mjs