[njs] Fixed memory-leak introduced in b840b7af946e.

Dmitry Volyntsev xeioex at nginx.com
Thu Jan 16 16:35:04 UTC 2020


details:   https://hg.nginx.org/njs/rev/22e3b0285ad6
branches:  
changeset: 1302:22e3b0285ad6
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Jan 16 19:18:41 2020 +0300
description:
Fixed memory-leak introduced in b840b7af946e.

diffstat:

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

diffs (26 lines):

diff -r 6fccbc9f1288 -r 22e3b0285ad6 src/njs_json.c
--- a/src/njs_json.c	Thu Jan 16 19:18:39 2020 +0300
+++ b/src/njs_json.c	Thu Jan 16 19:18:41 2020 +0300
@@ -2011,6 +2011,9 @@ njs_vm_value_dump(njs_vm_t *vm, njs_str_
             goto memory_error;
         }
 
+        visited.separate = 0;
+        visited.pointer = 0;
+
         goto done;
     }
 
@@ -2226,10 +2229,10 @@ njs_vm_value_dump(njs_vm_t *vm, njs_str_
         }
     }
 
+done:
+
     njs_arr_destroy(&visited);
 
-done:
-
     ret = njs_chb_join(&chain, &str);
     if (njs_slow_path(ret != NJS_OK)) {
         goto memory_error;


More information about the nginx-devel mailing list