[dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free.
Stephen Hemminger
stephen at networkplumber.org
Tue May 19 23:33:55 CEST 2015
On Tue, 19 May 2015 12:54:35 -0700
eziegenb <eziegenb at brocade.com> wrote:
> 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);
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
More information about the dev
mailing list