* [PATCH] perf tools: Free strlist in strlist__delete()
@ 2013-09-06 5:35 Namhyung Kim
2013-09-06 14:05 ` David Ahern
0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2013-09-06 5:35 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Namhyung Kim, LKML,
Jiri Olsa, David Ahern
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)
--
1.7.11.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] perf tools: Free strlist in strlist__delete()
2013-09-06 5:35 [PATCH] perf tools: Free strlist in strlist__delete() Namhyung Kim
@ 2013-09-06 14:05 ` David Ahern
0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2013-09-06 14:05 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras,
Ingo Molnar, Namhyung Kim, LKML, Jiri Olsa
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-06 14:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-06 5:35 [PATCH] perf tools: Free strlist in strlist__delete() Namhyung Kim
2013-09-06 14:05 ` David Ahern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox