Message ID | 20170214052938.16727-1-leon@kernel.org |
---|---|
State | Accepted, archived |
Delegated to: | stephen hemminger |
Headers | show |
On Tue, 14 Feb 2017 07:29:38 +0200 Leon Romanovsky <leon@kernel.org> wrote: > From: Leon Romanovsky <leonro@mellanox.com> > > Prior to parsing command options, the devlink tool allocates memory > to store results. In case of early exit (wrong parameters or version > check), this memory wasn't freed. > > Signed-off-by: Leon Romanovsky <leonro@mellanox.com> > Acked-by: Jiri Pirko <jiri@mellanox.com> Applied, thanks.
diff --git a/devlink/devlink.c b/devlink/devlink.c index 23db9e7c..34a409f7 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -2579,7 +2579,8 @@ int main(int argc, char **argv) switch (opt) { case 'V': printf("devlink utility, iproute2-ss%s\n", SNAPSHOT); - return EXIT_SUCCESS; + ret = EXIT_SUCCESS; + goto dl_free; case 'n': dl->no_nice_names = true; break; @@ -2592,7 +2593,8 @@ int main(int argc, char **argv) default: pr_err("Unknown option.\n"); help(); - return EXIT_FAILURE; + ret = EXIT_FAILURE; + goto dl_free; } }