perf tools: Free strlist in strlist__delete()
Namhyung Kim
maintainerPATCH 1/1 perf tools: Free strlist in strlist__delete()
From: Namhyung Kim <[email protected]>
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 <[email protected]>
--- tools/perf/util/strlist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/util/strlist.c +3 -1
@@ -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)
Signature · 1 line
1.7.11.7
Quoted 17 lines · Namhyung Kim
From: Namhyung Kim <[email protected]>
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 <[email protected]>--- tools/perf/util/strlist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tools/perf/util/strlist.c +0
-0@@ -155,8 +155,10 @@ out_error:
tools/perf/util/strlist.c out_error: · line 164
Quoted 10 lines
tools/perf/util/strlist.c +3
-1void 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 <[email protected]>