netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] devlink: Call dl_free in early exit case
@ 2017-02-14  5:29 Leon Romanovsky
  2017-02-19  0:30 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2017-02-14  5:29 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: linux-netdev, Leon Romanovsky

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>
---
 devlink/devlink.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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;
 		}
 	}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2] devlink: Call dl_free in early exit case
  2017-02-14  5:29 [PATCH iproute2] devlink: Call dl_free in early exit case Leon Romanovsky
@ 2017-02-19  0:30 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2017-02-19  0:30 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-netdev, Leon Romanovsky

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-19  0:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-14  5:29 [PATCH iproute2] devlink: Call dl_free in early exit case Leon Romanovsky
2017-02-19  0:30 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).