Re: [PATCH] perf tools: Free strlist in strlist__delete()

From: David Ahern
Date: Fri Sep 06 2013 - 10:05:24 EST


On 9/5/13 11:35 PM, Namhyung Kim wrote:
From: Namhyung Kim <namhyung.kim@xxxxxxx>

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@xxxxxxxxxx>
---
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@xxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/