From ab85751978d69ab29316954585898f8030424cb4 Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Tue, 27 Feb 2018 14:10:36 +0300 Subject: [PATCH] Fixed memory leak in CLI. --- njs/njs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/njs/njs.c b/njs/njs.c index c4bdb1ca..4ce9e093 100644 --- a/njs/njs.c +++ b/njs/njs.c @@ -253,6 +253,7 @@ njs_interactive_shell(njs_opts_t *opts, njs_vm_opt_t *vm_options) } 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_vm_opt_t *vm_options) 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); -- 2.47.3