DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] Mem: Fixes small memory leak due to missing free.
@ 2015-05-20  0:04 Erik Ziegenbalg
  2015-05-29 17:42 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Erik Ziegenbalg @ 2015-05-20  0:04 UTC (permalink / raw)
  To: dev

From: eziegenb <eziegenb@brocade.com>

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

Signed-off-by: Erik Ziegenbalg <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] 2+ messages in thread

* Re: [dpdk-dev] [PATCH v2] Mem: Fixes small memory leak due to missing free.
  2015-05-20  0:04 [dpdk-dev] [PATCH v2] Mem: Fixes small memory leak due to missing free Erik Ziegenbalg
@ 2015-05-29 17:42 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2015-05-29 17:42 UTC (permalink / raw)
  To: Erik Ziegenbalg; +Cc: dev

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

You forgot to add a changelog and the previous acked-by:
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: John McNamara <john.mcnamara@intel.com>

> -	if (ret < 0)
> +	if (ret < 0){

checkpatch complains about a missing space.

Applied with the above fix, thanks

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

end of thread, other threads:[~2015-05-29 18:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20  0:04 [dpdk-dev] [PATCH v2] Mem: Fixes small memory leak due to missing free Erik Ziegenbalg
2015-05-29 17:42 ` Thomas Monjalon

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