[njs] Fixed memory allocation failure introduced in fc8d1b125cef.

Dmitry Volyntsev xeioex at nginx.com
Thu May 11 04:26:16 UTC 2023


details:   https://hg.nginx.org/njs/rev/a140e71b0fbf
branches:  
changeset: 2115:a140e71b0fbf
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed May 10 20:50:53 2023 -0700
description:
Fixed memory allocation failure introduced in fc8d1b125cef.

Found by Coverity (CID 1529969).

diffstat:

 src/njs_builtin.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 89c821242caf -r a140e71b0fbf src/njs_builtin.c
--- a/src/njs_builtin.c	Tue May 09 22:09:13 2023 -0700
+++ b/src/njs_builtin.c	Wed May 10 20:50:53 2023 -0700
@@ -756,7 +756,7 @@ njs_object_completions(njs_vm_t *vm, njs
 
             completion->length = (prefix - expression->start) + key.length + 1;
             completion->start = njs_mp_alloc(vm->mem_pool, completion->length);
-            if (completion == NULL) {
+            if (njs_slow_path(completion->start == NULL)) {
                 njs_arr_destroy(array);
                 array = NULL;
                 goto done;


More information about the nginx-devel mailing list