提交 17577dec 编写于 作者: M Masami Hiramatsu 提交者: Arnaldo Carvalho de Melo

perf hists: Fix hists_evsel to release hists

Since hists__init doesn't set the destructor of hists_evsel (which is an
extended evsel structure), when hists_evsel is released, the extended
part of the hists_evsel is not deleted (note that the hists_evsel object
itself is freed).

This fixes it to add a destructor for hists__evsel and to set it up.
Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20151209021129.10245.28710.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 544c2ae7
...@@ -1567,6 +1567,13 @@ static int hists_evsel__init(struct perf_evsel *evsel) ...@@ -1567,6 +1567,13 @@ static int hists_evsel__init(struct perf_evsel *evsel)
return 0; return 0;
} }
static void hists_evsel__exit(struct perf_evsel *evsel)
{
struct hists *hists = evsel__hists(evsel);
hists__delete_entries(hists);
}
/* /*
* XXX We probably need a hists_evsel__exit() to free the hist_entries * XXX We probably need a hists_evsel__exit() to free the hist_entries
* stored in the rbtree... * stored in the rbtree...
...@@ -1575,7 +1582,8 @@ static int hists_evsel__init(struct perf_evsel *evsel) ...@@ -1575,7 +1582,8 @@ static int hists_evsel__init(struct perf_evsel *evsel)
int hists__init(void) int hists__init(void)
{ {
int err = perf_evsel__object_config(sizeof(struct hists_evsel), int err = perf_evsel__object_config(sizeof(struct hists_evsel),
hists_evsel__init, NULL); hists_evsel__init,
hists_evsel__exit);
if (err) if (err)
fputs("FATAL ERROR: Couldn't setup hists class\n", stderr); fputs("FATAL ERROR: Couldn't setup hists class\n", stderr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册