public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>
Subject: Re: [PATCH] perf tools: Free strlist in strlist__delete()
Date: Fri, 06 Sep 2013 08:05:17 -0600	[thread overview]
Message-ID: <5229E11D.9080407@gmail.com> (raw)
In-Reply-To: <1378445726-10877-1-git-send-email-namhyung@kernel.org>

On 9/5/13 11:35 PM, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@lge.com>
>
> It seems strlist never deleted after allocated.  AFAICS every strlist
> is allocated dynamically, just free it in the _delete() function.
>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>   tools/perf/util/strlist.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/strlist.c b/tools/perf/util/strlist.c
> index eabdce0a2daa..11593d899eb2 100644
> --- a/tools/perf/util/strlist.c
> +++ b/tools/perf/util/strlist.c
> @@ -155,8 +155,10 @@ out_error:
>
>   void strlist__delete(struct strlist *slist)
>   {
> -	if (slist != NULL)
> +	if (slist != NULL) {
>   		rblist__delete(&slist->rblist);
> +		free(slist);
> +	}
>   }
>
>   struct str_node *strlist__entry(const struct strlist *slist, unsigned int idx)
>

Yes, strlist__delete is the counterpart to strlist__new; the new 
function allocates the memory, so the delete should free it.

Acked-by: David Ahern <dsahern@gmail.com>

      reply	other threads:[~2013-09-06 14:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-06  5:35 [PATCH] perf tools: Free strlist in strlist__delete() Namhyung Kim
2013-09-06 14:05 ` David Ahern [this message]

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=5229E11D.9080407@gmail.com \
    --to=dsahern@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    /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