[ethtool] 15/20: ethtool: fix leakage of strings resources in get_feature_defs

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Mon Oct 17 04:09:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch master
in repository ethtool.

commit 9674a827b9baf1503a69dd91b7981a163bd45e77
Author: John W. Linville <linville at tuxdriver.com>
Date:   Fri Sep 30 14:57:27 2016 -0400

    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 at tuxdriver.com>
    Reviewed-by: Greg Rose <grose at lightfleet.com>
---
 ethtool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ethtool.c b/ethtool.c
index b8de652..49ac94e 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));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/ethtool.git



More information about the Kernel-svn-changes mailing list