diff mbox

[3/7] ethtool: plug resource leaks of defs and features in do_gfeatures

Message ID 1475265381-28937-4-git-send-email-linville@tuxdriver.com
State Accepted, archived
Delegated to: John Linville
Headers show

Commit Message

John W. Linville Sept. 30, 2016, 7:56 p.m. UTC
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 mbox

Patch

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;
 }