]> git.kaiwu.me - njs.git/commit
Buffer: free QJS buffers on conversion failures
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 24 Sep 2026 22:53:56 +0000 (15:53 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Fri, 25 Sep 2026 23:00:29 +0000 (16:00 -0700)
commit6a6e7f404a642f23fcb61b4d928eb14b7466326c
tree774b20890a26ba276d47f4a22cfc828d25cd8e9d
parent5832bed4ecc1cb4cb199594ef8091f9a5b7b6195
Buffer: free QJS buffers on conversion failures

qjs_buffer_from_string() and qjs_buffer_create() leaked the newly
allocated buffer when qjs_typed_array_data() or string decoding failed.

Also check the JS_ToCStringLen() result in qjs_buffer_from_string(), so
an allocation failure is not followed by a NULL pointer dereference.
src/qjs_buffer.c