Welcome! Log In Create A New Profile

Advanced

[njs] Shell: fixed memory leak when empty line is entered.

Alexander Borisov
December 03, 2019 08:46AM
details: https://hg.nginx.org/njs/rev/afe38b7fabe4
branches:
changeset: 1273:afe38b7fabe4
user: Alexander Borisov <alexander.borisov@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);
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Shell: fixed memory leak when empty line is entered.

Alexander Borisov 43 December 03, 2019 08:46AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 80
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready