From: eziegenb <ezieg...@brocade.com>

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

Signed-off-by: Erik Ziegenbalg <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

Reply via email to