Skip to content

Commit d487a2a

Browse files
author
Rob Sanders
committed
Fix memory leak in linewrap code for help items
1 parent 48de4cb commit d487a2a

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

libcli.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ int cli_done(struct cli_def *cli) {
737737

738738
if (cli->buildmode) cli_int_free_buildmode(cli);
739739
cli_unregister_tree(cli, cli->commands, CLI_ANY_COMMAND);
740+
free_z(cli->promptchar);
740741
free_z(cli->modestring);
741742
free_z(cli->banner);
742743
free_z(cli->promptchar);
@@ -3142,6 +3143,7 @@ void cli_int_wrap_help_line(char *nameptr, char *helpptr, struct cli_comphelp *c
31423143
if ((nameptr != emptystring) && (strlen(nameptr) > MAXWIDTHCOL1)) {
31433144
if (asprintf(&line, "%s", nameptr) < 0) break;
31443145
cli_add_comphelp_entry(comphelp, line);
3146+
free_z(line);
31453147
nameptr = emptystring;
31463148
namewidth = MAXWIDTHCOL1;
31473149
}

libcli.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ rm -rf $RPM_BUILD_ROOT
7070
* Wed Feb 24 2021 Rob Sanders <rsanders.forcepoint.com> 1.10.7
7171
- Fix bug were an extra newline was being inserted on every line
7272
when help was being requested for options and arguments
73+
- Fix memory leak in linewrapping code for help items
7374

7475
* Mon Feb 22 2021 Rob Sanders <rsanders.forcepoint.com> 1.10.6
7576
- Fix bug when a command not found in the current mode, but is found

0 commit comments

Comments
 (0)