summaryrefslogtreecommitdiff
path: root/tools/perf/tests/hists_common.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2015-12-14 12:11:13 +0900
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-12-14 12:15:07 -0300
commit71d6de64feddd4b455555326fba2111b3006d9e0 (patch)
tree69b2204f16281a0aab39381c7b4efe4118dc28df /tools/perf/tests/hists_common.c
parentbd0f889536f80630c1c4a414f2de90744d2c87d0 (diff)
perf test: Fix hist testcases when kptr_restrict is on
Currently if kptr_restrict is enabled, all hist tests failed with segfaults. This is because machine__create_kernel_maps() in setup_fake_machine() failed in that situation, and it called machine__delete() on the error path. But outer callers again called machines__exit() causing double free for the host machine. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1450062673-22312-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/hists_common.c')
-rw-r--r--tools/perf/tests/hists_common.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index 46f453b1de60..bcfd081ee1d2 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -88,8 +88,8 @@ struct machine *setup_fake_machine(struct machines *machines)
}
if (machine__create_kernel_maps(machine)) {
- pr_debug("Not enough memory for machine setup\n");
- goto out;
+ pr_debug("Cannot create kernel maps\n");
+ return NULL;
}
for (i = 0; i < ARRAY_SIZE(fake_threads); i++) {
@@ -155,7 +155,6 @@ struct machine *setup_fake_machine(struct machines *machines)
out:
pr_debug("Not enough memory for machine setup\n");
machine__delete_threads(machine);
- machine__delete(machine);
return NULL;
}