]> git.kaiwu.me - njs.git/commitdiff
Stream: fixed variable value state on allocation failure
authorDmitry Volyntsev <xeioex@nginx.com>
Wed, 3 Jun 2026 02:06:39 +0000 (19:06 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Wed, 3 Jun 2026 21:34:17 +0000 (14:34 -0700)
Reset the variable value validity flag when allocating storage for a stream
variable fails.  This matches the HTTP variable path and prevents a failed
assignment from leaving a half-initialized value marked as valid.

nginx/ngx_stream_js_module.c

index 0662ea5d360da9702eaa7bd6f3f76c8a1c5b99d0..308ddfd1a8b637a3de813582fd0591f843cd2348 100644 (file)
@@ -1951,6 +1951,8 @@ ngx_stream_js_session_variables(njs_vm_t *vm, njs_object_prop_t *prop,
 
     vv->data = ngx_pnalloc(s->connection->pool, val.length);
     if (vv->data == NULL) {
+        vv->valid = 0;
+        njs_vm_memory_error(vm);
         return NJS_ERROR;
     }