[PATCH iproute2] devlink: Call dl_free in early exit case

Subsystems: the rest

STALE3472d REVIEWED: 1 (0M)

1 review trailer.

2 messages, 2 authors, 2017-02-19 · open the first message on its own page

[PATCH iproute2] devlink: Call dl_free in early exit case

From: Leon Romanovsky <leon@kernel.org>
Date: 2017-02-14 05:29:32

From: Leon Romanovsky <redacted>

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 <redacted>
Acked-by: Jiri Pirko <redacted>
---
 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;
 		}
 	}

Re: [PATCH iproute2] devlink: Call dl_free in early exit case

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2017-02-19 00:30:37

On Tue, 14 Feb 2017 07:29:38 +0200
Leon Romanovsky [off-list ref] wrote:
From: Leon Romanovsky <redacted>

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 <redacted>
Acked-by: Jiri Pirko <redacted>
Applied, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help