netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Ethtool: Free memory leak in do_sprivflags()
@ 2013-06-12 11:59 Yuval Mintz
  2013-07-01 15:59 ` Ben Hutchings
  0 siblings, 1 reply; 2+ messages in thread
From: Yuval Mintz @ 2013-06-12 11:59 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, Yuval Mintz

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

Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
---
 ethtool.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ethtool.c b/ethtool.c
index 8cc10b5..b80494d 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -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)) {
-- 
1.8.1.227.g44fe835

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Ethtool: Free memory leak in do_sprivflags()
  2013-06-12 11:59 [PATCH] Ethtool: Free memory leak in do_sprivflags() Yuval Mintz
@ 2013-07-01 15:59 ` Ben Hutchings
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Hutchings @ 2013-07-01 15:59 UTC (permalink / raw)
  To: Yuval Mintz; +Cc: netdev

On Wed, 2013-06-12 at 14:59 +0300, Yuval Mintz wrote:
> cmdline is allocated for usage in parse_generic_cmdline(), but is not
> released after its final usage.
> 
> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>

Applied.

Ben.

> ---
>  ethtool.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/ethtool.c b/ethtool.c
> index 8cc10b5..b80494d 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -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)) {

-- 
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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-01 15:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-12 11:59 [PATCH] Ethtool: Free memory leak in do_sprivflags() Yuval Mintz
2013-07-01 15:59 ` Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).