From: Maxim Petrov Date: Tue, 15 Feb 2022 20:53:47 +0000 (+0300) Subject: lnstat: fix strdup leak in -w argument parsing X-Git-Tag: v5.17.0~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc143bda6bcec20d073f42162f06dde8998551d4;p=thirdparty%2Fiproute2.git lnstat: fix strdup leak in -w argument parsing 'tmp' string is used for safe tokenizing, but it is not required after getting all the widths in -w option. As 'tmp' string is obtained by strdup call, the caller has to deallocate it to avoid memory leak. Signed-off-by: Maxim Petrov Signed-off-by: Stephen Hemminger --- diff --git a/misc/lnstat.c b/misc/lnstat.c index 98904d45e..c3293a8eb 100644 --- a/misc/lnstat.c +++ b/misc/lnstat.c @@ -331,6 +331,7 @@ int main(int argc, char **argv) for (i = 0; i < MAX_FIELDS; i++) fp.params[i].print.width = len; } + free(tmp); break; default: usage(argv[0], 1);