perf tools: Unlink entries from terms list
authorWang Nan <wangnan0@huawei.com>
Fri, 12 Feb 2016 19:31:23 +0000 (16:31 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 12 Feb 2016 19:51:15 +0000 (16:51 -0300)
We were just freeing them, better unlink and init its nodes to catch
bugs faster if we keep dangling references to them.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
[ Spun off from another patch, use list_del_init() instead of list_del() ]
Link: http://lkml.kernel.org/r/1454680939-24963-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/parse-events.c

index 813d9b272c813b0dd749470f6209aa3a0a0607b4..133c8d28f36c7961045098a28bdc4b2bae40e135 100644 (file)
@@ -2072,8 +2072,10 @@ void parse_events__free_terms(struct list_head *terms)
 {
        struct parse_events_term *term, *h;
 
-       list_for_each_entry_safe(term, h, terms, list)
+       list_for_each_entry_safe(term, h, terms, list) {
+               list_del_init(&term->list);
                free(term);
+       }
 }
 
 void parse_events_evlist_error(struct parse_events_evlist *data,