]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
lnstat: fix strdup leak in -w argument parsing
authorMaxim Petrov <mmrmaximuzz@gmail.com>
Tue, 15 Feb 2022 20:53:47 +0000 (23:53 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 16 Feb 2022 20:14:35 +0000 (12:14 -0800)
'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@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
misc/lnstat.c

index 98904d45e6b43bb7141963fd3cf2558ce4512a8c..c3293a8eb12fef256cd52d9bd9d19c2047c85a38 100644 (file)
@@ -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);