Skip to contentSkip to conversation

Ethtool: Free memory leak in do_sprivflags()

PATCH Applied Yuval Mintz 2 participants 2 messages Jun 12, 2013 – Jul 1, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Ethtool: Free memory leak in do_sprivflags()

cmdline is allocated for usage in parse_generic_cmdline(), but is not released after its final usage.

---
 ethtool.c | 1 +
 1 file changed, 1 insertion(+)
ethtool.c +1 -0
index 8cc10b5..b80494d 100644
@@ -3521,6 +3521,7 @@ static int do_sprivflags(struct cmd_context *ctx)
 		cmdline[i].seen_val = &seen_flags;
 	}
 	parse_generic_cmdline(ctx, &any_changed, cmdline, strings->len);
+	free(cmdline);
 
 	flags.cmd = ETHTOOL_GPFLAGS;
 	if (send_ioctl(ctx, &flags)) {
Signature · 1 line
1.8.1.227.g44fe835
#1 lore raw
Quoted 4 lines · Yuval Mintz

cmdline is allocated for usage in parse_generic_cmdline(), but is not released after its final usage.

Applied.

Ben.

Quoted 16 lines
---
 ethtool.c | 1 +
 1 file changed, 1 insertion(+)
ethtool.c +1 -0
index 8cc10b5..b80494d 100644
@@ -3521,6 +3521,7 @@ static int do_sprivflags(struct cmd_context *ctx)
 		cmdline[i].seen_val = &seen_flags;
 	}
 	parse_generic_cmdline(ctx, &any_changed, cmdline, strings->len);
+	free(cmdline);
 
 	flags.cmd = ETHTOOL_GPFLAGS;
 	if (send_ioctl(ctx, &flags)) {
Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.