[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <9766312d-58ae-4219-036e-73a587de1111@gmail.com>
Date: Tue, 15 Feb 2022 23:53:47 +0300
From: Maxim Petrov <mmrmaximuzz@...il.com>
To: netdev@...r.kernel.org
Cc: Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2] 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 <mmrmaximuzz@...il.com>
---
misc/lnstat.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/misc/lnstat.c b/misc/lnstat.c
index 98904d45..c3293a8e 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);
--
2.25.1
Powered by blists - more mailing lists