[njs] Fixed njs_array_expand() for empty arrays.

Dmitry Volyntsev xeioex at nginx.com
Sat Jun 11 07:16:55 UTC 2022


details:   https://hg.nginx.org/njs/rev/46ec9152a054
branches:  
changeset: 1884:46ec9152a054
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Sat Jun 11 00:15:28 2022 -0700
description:
Fixed njs_array_expand() for empty arrays.

diffstat:

 src/njs_array.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (14 lines):

diff -r aa4079d36ec3 -r 46ec9152a054 src/njs_array.c
--- a/src/njs_array.c	Sat Jun 11 00:15:27 2022 -0700
+++ b/src/njs_array.c	Sat Jun 11 00:15:28 2022 -0700
@@ -408,7 +408,9 @@ njs_array_expand(njs_vm_t *vm, njs_array
 
     array->start = start;
 
-    njs_mp_free(vm->mem_pool, old);
+    if (old != NULL) {
+        njs_mp_free(vm->mem_pool, old);
+    }
 
     return NJS_OK;
 



More information about the nginx-devel mailing list