From: eziegenb <eziegenb@brocade.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free.
Date: Tue, 19 May 2015 12:54:35 -0700 [thread overview]
Message-ID: <1432065275-26905-1-git-send-email-eziegenb@brocade.com> (raw)
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
next reply other threads:[~2015-05-19 19:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 19:54 eziegenb [this message]
2015-05-19 21:33 ` Stephen Hemminger
2015-05-19 21:57 ` Thomas Monjalon
2015-05-19 22:38 ` Mcnamara, John
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432065275-26905-1-git-send-email-eziegenb@brocade.com \
--to=eziegenb@brocade.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).