[dpdk-dev,v2] Mem: Fixes small memory leak due to missing free.
Commit Message
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(-)
Comments
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
@@ -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);