[dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free.
eziegenb
eziegenb at brocade.com
Tue May 19 21:54:35 CEST 2015
A function in cmdline.c has a return that does not free buf properly.
Signed-off-by: eziegenb <eziegenb at 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
More information about the dev
mailing list