[njs] Fixed memory leak in CLI.

Dmitry Volyntsev xeioex at nginx.com
Tue Feb 27 11:18:06 UTC 2018


details:   http://hg.nginx.org/njs/rev/ee00992356d9
branches:  
changeset: 451:ee00992356d9
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Tue Feb 27 14:10:36 2018 +0300
description:
Fixed memory leak in CLI.

diffstat:

 njs/njs.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (25 lines):

diff -r 757271547b56 -r ee00992356d9 njs/njs.c
--- a/njs/njs.c	Tue Feb 20 19:12:55 2018 +0300
+++ b/njs/njs.c	Tue Feb 27 14:10:36 2018 +0300
@@ -253,6 +253,7 @@ njs_interactive_shell(njs_opts_t *opts, 
     }
 
     if (njs_externals_init(vm) != NXT_OK) {
+        fprintf(stderr, "failed to add external protos\n");
         return NXT_ERROR;
     }
 
@@ -389,8 +390,11 @@ njs_process_file(njs_opts_t *opts, njs_v
         goto done;
     }
 
-    if (njs_externals_init(vm) != NXT_OK) {
-        return NXT_ERROR;
+    ret = njs_externals_init(vm);
+    if (ret != NXT_OK) {
+        fprintf(stderr, "failed to add external protos\n");
+        ret = NXT_ERROR;
+        goto done;
     }
 
     ret = njs_process_script(vm, opts, &script, &out);


More information about the nginx-devel mailing list