From: Erik Ziegenbalg Date: Wed, 20 May 2015 00:04:55 +0000 (-0700) Subject: cmdline: fix small memory leak X-Git-Tag: spdx-start~9156 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5f3aa4a702d2cf4c05f52f3eb5fba7437e76bde7;p=dpdk.git cmdline: fix small memory leak A function in cmdline.c has a return that does not free buf properly. Signed-off-by: Erik Ziegenbalg Acked-by: Stephen Hemminger Acked-by: John McNamara --- diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c index 6a55f1f5d4..c405878ee8 100644 --- a/lib/librte_cmdline/cmdline.c +++ b/lib/librte_cmdline/cmdline.c @@ -193,8 +193,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);