[njs] Shell: fixed memory leak when empty line is entered.
Alexander Borisov
alexander.borisov at nginx.com
Tue Dec 3 13:44:29 UTC 2019
details: https://hg.nginx.org/njs/rev/afe38b7fabe4
branches:
changeset: 1273:afe38b7fabe4
user: Alexander Borisov <alexander.borisov at nginx.com>
date: Tue Dec 03 16:43:04 2019 +0300
description:
Shell: fixed memory leak when empty line is entered.
diffstat:
src/njs_shell.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diffs (21 lines):
diff -r 5b1bf60c8ede -r afe38b7fabe4 src/njs_shell.c
--- a/src/njs_shell.c Tue Dec 03 14:59:26 2019 +0300
+++ b/src/njs_shell.c Tue Dec 03 16:43:04 2019 +0300
@@ -869,13 +869,12 @@ njs_interactive_shell(njs_opts_t *opts,
}
line.length = njs_strlen(line.start);
- if (line.length == 0) {
- continue;
- }
- add_history((char *) line.start);
+ if (line.length != 0) {
+ add_history((char *) line.start);
- njs_process_script(opts, vm_options->external, &line);
+ njs_process_script(opts, vm_options->external, &line);
+ }
/* editline allocs a new buffer every time. */
free(line.start);
More information about the nginx-devel
mailing list