From: Leon Romanovsky <leon@kernel.org>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: linux-netdev <netdev@vger.kernel.org>,
Leon Romanovsky <leonro@mellanox.com>
Subject: [PATCH iproute2] devlink: Call dl_free in early exit case
Date: Tue, 14 Feb 2017 07:29:38 +0200 [thread overview]
Message-ID: <20170214052938.16727-1-leon@kernel.org> (raw)
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;
}
}
next reply other threads:[~2017-02-14 5:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-14 5:29 Leon Romanovsky [this message]
2017-02-19 0:30 ` [PATCH iproute2] devlink: Call dl_free in early exit case Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170214052938.16727-1-leon@kernel.org \
--to=leon@kernel.org \
--cc=leonro@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).