All of lore.kernel.org
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: netdev@vger.kernel.org
Cc: "John W. Linville" <linville@tuxdriver.com>
Subject: [PATCH 3/7] ethtool: plug resource leaks of defs and features in do_gfeatures
Date: Fri, 30 Sep 2016 15:56:17 -0400	[thread overview]
Message-ID: <1475265381-28937-4-git-send-email-linville@tuxdriver.com> (raw)
In-Reply-To: <1475265381-28937-1-git-send-email-linville@tuxdriver.com>

Coverity issues: 1363120, 1363121
Fixes: 6042804cf6ec ("Change -k/-K options to use ETHTOOL_{G,S}FEATURES")

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 ethtool.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ethtool.c b/ethtool.c
index 0885a61097ad..09486615a5bb 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2233,10 +2233,13 @@ static int do_gfeatures(struct cmd_context *ctx)
 	features = get_features(ctx, defs);
 	if (!features) {
 		fprintf(stdout, "no feature info available\n");
+		free(defs);
 		return 1;
 	}
 
 	dump_features(defs, features, NULL);
+	free(features);
+	free(defs);
 	return 0;
 }
 
-- 
2.7.4

  parent reply	other threads:[~2016-09-30 20:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-30 19:56 [PATCH 0/7] ethtool: misc fixes for Coverity issues John W. Linville
2016-09-30 19:56 ` [PATCH 1/7] ethtool: avoid NULL pointer dereference in do_permaddr John W. Linville
2016-09-30 19:56 ` [PATCH 2/7] ethtool: avoid resource leak of strings in do_gprivflags John W. Linville
2016-10-03 17:54   ` Jarod Wilson
2016-10-04 14:02     ` John W. Linville
2016-10-04 14:05   ` [PATCH v2 " John W. Linville
2016-09-30 19:56 ` John W. Linville [this message]
2016-09-30 19:56 ` [PATCH 4/7] ethtool: fix leakage of defs resources in do_sfeatures John W. Linville
2016-09-30 19:56 ` [PATCH 5/7] ethtool: fix leakage of efeatures " John W. Linville
2016-09-30 19:56 ` [PATCH 6/7] ethtool: fix leakage of strings resources in do_sprivflags John W. Linville
2016-09-30 19:56 ` [PATCH 7/7] ethtool: fix leakage of strings resources in get_feature_defs John W. Linville
2016-09-30 20:26 ` [PATCH 0/7] ethtool: misc fixes for Coverity issues Greg

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=1475265381-28937-4-git-send-email-linville@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.