]> git.kaiwu.me - njs.git/commitdiff
Modules: fixed items() method of a shared dictionary.
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 17 Oct 2023 01:09:37 +0000 (18:09 -0700)
committerDmitry Volyntsev <xeioex@nginx.com>
Tue, 17 Oct 2023 01:09:37 +0000 (18:09 -0700)
Previously, under a memory pressure the method might return
prematurely while still holding the mutex for the shared memory.

This fixes #676 issue on Github.

nginx/ngx_js_shared_dict.c

index c36a585b7598be4352c5d3aed84cb0f7e4d2f75a..144941478d977dbc2554bcf0ad8012ac6ccf5eac 100644 (file)
@@ -819,7 +819,7 @@ njs_js_ext_shared_dict_items(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
 
         rc = njs_vm_array_alloc(vm, kv, 2);
         if (rc != NJS_OK) {
-            return NJS_ERROR;
+            goto fail;
         }
 
         value = njs_vm_array_push(vm, kv);