On Sun, Sep 03, 2017 at 03:19:15PM -0500, Scott Cheloha wrote:
> Feedback?
It looks like progressmeter() can be called with flag -1 consecutively
due to some error path. So better free the title. It cannot hurt.
OK bluhm@
> Index: usr.bin/ftp/util.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/ftp/util.c,v
> retrieving revision 1.84
> diff -u -p -r1.84 util.c
> --- usr.bin/ftp/util.c 21 Jan 2017 08:33:07 -0000 1.84
> +++ usr.bin/ftp/util.c 3 Sep 2017 19:52:26 -0000
> @@ -784,8 +784,10 @@ progressmeter(int flag, const char *file
> ratio = MINIMUM(ratio, 100);
> if (!verbose && flag == -1) {
> filename = basename(filename);
> - if (filename != NULL)
> + if (filename != NULL) {
> + free(title);
> title = strdup(filename);
> + }
> }
>
> buf[0] = 0;