DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free.
@ 2015-05-19 19:54 eziegenb
  2015-05-19 21:33 ` Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: eziegenb @ 2015-05-19 19:54 UTC (permalink / raw)
  To: dev

A function in cmdline.c has a return that does not free buf properly.

Signed-off-by: eziegenb <eziegenb@brocade.com>
---
 lib/librte_cmdline/cmdline.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c
index e61c4f2..747d3bb 100644
--- a/lib/librte_cmdline/cmdline.c
+++ b/lib/librte_cmdline/cmdline.c
@@ -192,8 +192,10 @@ cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
 	va_start(ap, fmt);
 	ret = vsnprintf(buf, BUFSIZ, fmt, ap);
 	va_end(ap);
-	if (ret < 0)
+	if (ret < 0){
+		free(buf);
 		return;
+	}
 	if (ret >= BUFSIZ)
 		ret = BUFSIZ - 1;
 	write(cl->s_out, buf, ret);
-- 
1.7.10.4

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

* Re: [dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free.
  2015-05-19 19:54 [dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free eziegenb
@ 2015-05-19 21:33 ` Stephen Hemminger
  2015-05-19 21:57 ` Thomas Monjalon
  2015-05-19 22:38 ` Mcnamara, John
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2015-05-19 21:33 UTC (permalink / raw)
  To: eziegenb; +Cc: dev

On Tue, 19 May 2015 12:54:35 -0700
eziegenb <eziegenb@brocade.com> wrote:

> A function in cmdline.c has a return that does not free buf properly.
> 
> Signed-off-by: eziegenb <eziegenb@brocade.com>
> ---
>  lib/librte_cmdline/cmdline.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c
> index e61c4f2..747d3bb 100644
> --- a/lib/librte_cmdline/cmdline.c
> +++ b/lib/librte_cmdline/cmdline.c
> @@ -192,8 +192,10 @@ cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
>  	va_start(ap, fmt);
>  	ret = vsnprintf(buf, BUFSIZ, fmt, ap);
>  	va_end(ap);
> -	if (ret < 0)
> +	if (ret < 0){
> +		free(buf);
>  		return;
> +	}
>  	if (ret >= BUFSIZ)
>  		ret = BUFSIZ - 1;
>  	write(cl->s_out, buf, ret);

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

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

* Re: [dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free.
  2015-05-19 19:54 [dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free eziegenb
  2015-05-19 21:33 ` Stephen Hemminger
@ 2015-05-19 21:57 ` Thomas Monjalon
  2015-05-19 22:38 ` Mcnamara, John
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2015-05-19 21:57 UTC (permalink / raw)
  To: eziegenb; +Cc: dev

Hi,

2015-05-19 12:54, eziegenb:
> A function in cmdline.c has a return that does not free buf properly.
> 
> Signed-off-by: eziegenb <eziegenb@brocade.com>

Is it possible to have your real name?
Thanks

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

* Re: [dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free.
  2015-05-19 19:54 [dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free eziegenb
  2015-05-19 21:33 ` Stephen Hemminger
  2015-05-19 21:57 ` Thomas Monjalon
@ 2015-05-19 22:38 ` Mcnamara, John
  2 siblings, 0 replies; 4+ messages in thread
From: Mcnamara, John @ 2015-05-19 22:38 UTC (permalink / raw)
  To: eziegenb, dev

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of eziegenb
> Sent: Tuesday, May 19, 2015 8:55 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing
> free.
> 
> A function in cmdline.c has a return that does not free buf properly.

That didn't turn up in the Coverity scan (perhaps because it is in the #else branch of an #ifdef) but it is a leak.

Acked-by: John McNamara <john.mcnamara@intel.com>

 

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

end of thread, other threads:[~2015-05-19 22:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-19 19:54 [dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free eziegenb
2015-05-19 21:33 ` Stephen Hemminger
2015-05-19 21:57 ` Thomas Monjalon
2015-05-19 22:38 ` Mcnamara, John

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