perf tests: Fix leaks on PERF_RECORD_* test

This test:

 7: Validate PERF_RECORD_* events & perf_sample fields

needs to call perf_evlist__delete_maps().

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-t3181qy15avffdacqjcxfku2@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c0aab59f
...@@ -96,7 +96,7 @@ int test__PERF_RECORD(void) ...@@ -96,7 +96,7 @@ int test__PERF_RECORD(void)
err = perf_evlist__prepare_workload(evlist, &opts, argv); err = perf_evlist__prepare_workload(evlist, &opts, argv);
if (err < 0) { if (err < 0) {
pr_debug("Couldn't run the workload!\n"); pr_debug("Couldn't run the workload!\n");
goto out_delete_evlist; goto out_delete_maps;
} }
/* /*
...@@ -111,7 +111,7 @@ int test__PERF_RECORD(void) ...@@ -111,7 +111,7 @@ int test__PERF_RECORD(void)
err = sched__get_first_possible_cpu(evlist->workload.pid, &cpu_mask); err = sched__get_first_possible_cpu(evlist->workload.pid, &cpu_mask);
if (err < 0) { if (err < 0) {
pr_debug("sched__get_first_possible_cpu: %s\n", strerror(errno)); pr_debug("sched__get_first_possible_cpu: %s\n", strerror(errno));
goto out_delete_evlist; goto out_delete_maps;
} }
cpu = err; cpu = err;
...@@ -121,7 +121,7 @@ int test__PERF_RECORD(void) ...@@ -121,7 +121,7 @@ int test__PERF_RECORD(void)
*/ */
if (sched_setaffinity(evlist->workload.pid, cpu_mask_size, &cpu_mask) < 0) { if (sched_setaffinity(evlist->workload.pid, cpu_mask_size, &cpu_mask) < 0) {
pr_debug("sched_setaffinity: %s\n", strerror(errno)); pr_debug("sched_setaffinity: %s\n", strerror(errno));
goto out_delete_evlist; goto out_delete_maps;
} }
/* /*
...@@ -131,7 +131,7 @@ int test__PERF_RECORD(void) ...@@ -131,7 +131,7 @@ int test__PERF_RECORD(void)
err = perf_evlist__open(evlist); err = perf_evlist__open(evlist);
if (err < 0) { if (err < 0) {
pr_debug("perf_evlist__open: %s\n", strerror(errno)); pr_debug("perf_evlist__open: %s\n", strerror(errno));
goto out_delete_evlist; goto out_delete_maps;
} }
/* /*
...@@ -142,7 +142,7 @@ int test__PERF_RECORD(void) ...@@ -142,7 +142,7 @@ int test__PERF_RECORD(void)
err = perf_evlist__mmap(evlist, opts.mmap_pages, false); err = perf_evlist__mmap(evlist, opts.mmap_pages, false);
if (err < 0) { if (err < 0) {
pr_debug("perf_evlist__mmap: %s\n", strerror(errno)); pr_debug("perf_evlist__mmap: %s\n", strerror(errno));
goto out_delete_evlist; goto out_delete_maps;
} }
/* /*
...@@ -305,6 +305,8 @@ int test__PERF_RECORD(void) ...@@ -305,6 +305,8 @@ int test__PERF_RECORD(void)
} }
out_err: out_err:
perf_evlist__munmap(evlist); perf_evlist__munmap(evlist);
out_delete_maps:
perf_evlist__delete_maps(evlist);
out_delete_evlist: out_delete_evlist:
perf_evlist__delete(evlist); perf_evlist__delete(evlist);
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment