DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: eziegenb <eziegenb@brocade.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] Mem: Fixes small memory leak due to missing free.
Date: Tue, 19 May 2015 14:33:55 -0700	[thread overview]
Message-ID: <20150519143355.0f35351a@uryu.home.lan> (raw)
In-Reply-To: <1432065275-26905-1-git-send-email-eziegenb@brocade.com>

On Tue, 19 May 2015 12:54:35 -0700
eziegenb <eziegenb@brocade.com> wrote:

> A function in cmdline.c has a return that does not free buf properly.
> 
> Signed-off-by: eziegenb <eziegenb@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@networkplumber.org>

  reply	other threads:[~2015-05-19 21:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19 19:54 eziegenb
2015-05-19 21:33 ` Stephen Hemminger [this message]
2015-05-19 21:57 ` Thomas Monjalon
2015-05-19 22:38 ` Mcnamara, John

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150519143355.0f35351a@uryu.home.lan \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=eziegenb@brocade.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).