[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1475265381-28937-8-git-send-email-linville@tuxdriver.com>
Date: Fri, 30 Sep 2016 15:56:21 -0400
From: "John W. Linville" <linville@...driver.com>
To: netdev@...r.kernel.org
Cc: "John W. Linville" <linville@...driver.com>
Subject: [PATCH 7/7] ethtool: fix leakage of strings resources in get_feature_defs
Coverity issue: 1363125
Fixes: 6042804cf6ec ("Change -k/-K options to use ETHTOOL_{G,S}FEATURES")
Signed-off-by: John W. Linville <linville@...driver.com>
---
ethtool.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ethtool.c b/ethtool.c
index 406cfd2f95a5..5b83a0041a95 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1715,8 +1715,10 @@ static struct feature_defs *get_feature_defs(struct cmd_context *ctx)
}
defs = malloc(sizeof(*defs) + sizeof(defs->def[0]) * n_features);
- if (!defs)
+ if (!defs) {
+ free(names);
return NULL;
+ }
defs->n_features = n_features;
memset(defs->off_flag_matched, 0, sizeof(defs->off_flag_matched));
--
2.7.4
Powered by blists - more mailing lists