diff options
author | Jiri Olsa <jolsa@kernel.org> | 2017-10-13 04:37:29 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-10-13 15:43:42 -0400 |
commit | d0e35234f647631ddfa5fa8c8ec66c9bc698f0ab (patch) | |
tree | a55490132931aabe43d2e2dd38ea2c0d80061d68 | |
parent | 70b01dfd765dd2196d51f33a49df23954416f34a (diff) |
perf hists: Add extra integrity checks to fmt_free()
Make sure the struct perf_hpp_fmt is properly unhooked before we free
it.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Changbin Du <changbin.du@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20171013083736.15037-3-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/ui/hist.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 6ee6b36bbc76..db79017a6e56 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -606,6 +606,13 @@ next: | |||
606 | 606 | ||
607 | static void fmt_free(struct perf_hpp_fmt *fmt) | 607 | static void fmt_free(struct perf_hpp_fmt *fmt) |
608 | { | 608 | { |
609 | /* | ||
610 | * At this point fmt should be completely | ||
611 | * unhooked, if not it's a bug. | ||
612 | */ | ||
613 | BUG_ON(!list_empty(&fmt->list)); | ||
614 | BUG_ON(!list_empty(&fmt->sort_list)); | ||
615 | |||
609 | if (fmt->free) | 616 | if (fmt->free) |
610 | fmt->free(fmt); | 617 | fmt->free(fmt); |
611 | } | 618 | } |