linux-stable/tools/perf/tests
Namhyung Kim 97ab7c524f perf test: Fix cpu and thread map leaks in sw_clock_freq test
The evlist has the maps with its own refcounts so we don't need to set
the pointers to NULL.  Otherwise following error was reported by Asan.

Also change the goto label since it doesn't need to have two.

  # perf test -v 25
  25: Software clock events period values        :
  --- start ---
  test child forked, pid 149154
  mmap size 528384B
  mmap size 528384B

  =================================================================
  ==149154==ERROR: LeakSanitizer: detected memory leaks

  Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7fef5cd071f8 in __interceptor_realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x56260d5e8b8e in perf_thread_map__realloc /home/namhyung/project/linux/tools/lib/perf/threadmap.c:23
    #2 0x56260d3df7a9 in thread_map__new_by_tid util/thread_map.c:63
    #3 0x56260d2ac6b2 in __test__sw_clock_freq tests/sw-clock.c:65
    #4 0x56260d26d8fb in run_test tests/builtin-test.c:428
    #5 0x56260d26d8fb in test_and_print tests/builtin-test.c:458
    #6 0x56260d26fa53 in __cmd_test tests/builtin-test.c:679
    #7 0x56260d26fa53 in cmd_test tests/builtin-test.c:825
    #8 0x56260d2dbb64 in run_builtin /home/namhyung/project/linux/tools/perf/perf.c:313
    #9 0x56260d165a88 in handle_internal_command /home/namhyung/project/linux/tools/perf/perf.c:365
    #10 0x56260d165a88 in run_argv /home/namhyung/project/linux/tools/perf/perf.c:409
    #11 0x56260d165a88 in main /home/namhyung/project/linux/tools/perf/perf.c:539
    #12 0x7fef5c83cd09 in __libc_start_main ../csu/libc-start.c:308

    ...
  test child finished with 1
  ---- end ----
  Software clock events period values      : FAILED!

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20210301140409.184570-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-03-06 16:54:28 -03:00
..
attr perf test: Leader sampling shouldn't clear sample period 2020-09-14 19:35:22 -03:00
shell perf daemon: Fix running test for non root user 2021-03-06 16:54:27 -03:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
api-io.c tools api: Add a lightweight buffered reading api 2020-04-30 10:48:28 -03:00
attr.c perf test: Fix a memory leak in attr test 2021-03-06 16:54:27 -03:00
attr.py
backward-ring-buffer.c perf evlist: Use the right prefix for 'struct evlist' event attribute config methods 2020-11-30 15:15:27 -03:00
bitmap.c
bp_account.c
bp_signal.c perf test: Fix the "signal" test inline assembly 2020-09-14 18:26:45 -03:00
bp_signal_overflow.c
bpf-script-example.c
bpf-script-test-kbuild.c
bpf-script-test-prologue.c
bpf-script-test-relocation.c
bpf.c perf evlist: Use the right prefix for 'struct evlist' event attribute config methods 2020-11-30 15:15:27 -03:00
Build perf tools: Add OCaml demangling 2021-02-17 15:15:06 -03:00
builtin-test.c perf tools: Add OCaml demangling 2021-02-17 15:15:06 -03:00
clang.c
code-reading.c perf tools: Add OCaml demangling 2021-02-17 15:15:06 -03:00
cpumap.c
demangle-java-test.c perf tests: Add test for the java demangler 2020-05-28 10:03:28 -03:00
demangle-ocaml-test.c perf tools: Add OCaml demangling 2021-02-17 15:15:06 -03:00
dso-data.c
dwarf-unwind.c perf tools: Remove broken __no_tail_call attribute 2020-11-03 08:32:15 -03:00
event-times.c perf evlist: Use the right prefix for 'struct evlist' create maps methods 2020-11-30 14:56:52 -03:00
event_update.c perf evlist: Use the right prefix for alternative 'struct evlist' constructors 2020-11-30 15:04:05 -03:00
evsel-roundtrip-name.c perf evsel: Rename perf_evsel__[hs]w_cache* to evsel__[hs]w_cache* 2020-05-28 10:03:24 -03:00
evsel-tp-sched.c perf evsel: Convert last 'struct evsel' methods to the right evsel__ prefix 2020-11-30 09:08:24 -03:00
expand-cgroup.c perf evlist: Use the right prefix for alternative 'struct evlist' constructors 2020-11-30 15:04:05 -03:00
expr.c perf metric: Add 'struct expr_id_data' to keep expr value 2020-07-17 09:09:48 -03:00
fdarray.c libperf: Add flags to fdarray fds objects 2020-07-21 09:52:51 -03:00
genelf.c
hists_common.c
hists_common.h
hists_cumulate.c perf evsel: Rename perf_evsel__resort*() to evsel__resort*() 2020-05-28 10:03:24 -03:00
hists_filter.c perf evsel: Rename perf_evsel__resort*() to evsel__resort*() 2020-05-28 10:03:24 -03:00
hists_link.c
hists_output.c perf evsel: Rename perf_evsel__resort*() to evsel__resort*() 2020-05-28 10:03:24 -03:00
is_printable_array.c
keep-tracking.c perf evlist: Use the right prefix for 'struct evlist' event attribute config methods 2020-11-30 15:15:27 -03:00
kmod-path.c
llvm.c perf tests: Skip the llvm and bpf tests if HAVE_LIBBPF_SUPPORT isn't defined 2020-11-04 09:42:41 -03:00
llvm.h
make perf tools: Add build test with GTK+ 2020-09-09 11:12:10 -03:00
maps.c
mem.c
mem2node.c
mmap-basic.c perf test: Fix cpu and thread map leaks in basic mmap test 2021-03-06 16:54:27 -03:00
mmap-thread-lookup.c
openat-syscall-all-cpus.c perf env: Remove unneeded internal/cpumap inclusions 2021-02-12 17:35:48 -03:00
openat-syscall-tp-fields.c perf evlist: Use the right prefix for alternative 'struct evlist' constructors 2020-11-30 15:04:05 -03:00
openat-syscall.c perf evsel: Rename perf_evsel__new*() to evsel__new*() 2020-05-28 10:03:24 -03:00
parse-events.c perf evlist: Use the right prefix for 'struct evlist' event attribute config methods 2020-11-30 15:15:27 -03:00
parse-metric.c perf test: Add parse-metric memory bandwidth testcase 2021-02-03 13:10:27 -03:00
parse-no-sample-id-all.c perf evlist: Use the right prefix for 'struct evlist' sample parsing methods 2020-11-30 09:43:07 -03:00
pe-file-parsing.c perf tools: Pass build_id object to filename__read_build_id() 2020-10-14 08:45:16 -03:00
pe-file.c perf tests: Add test for PE binary format support 2020-09-04 14:38:15 -03:00
pe-file.exe perf tests: Add test for PE binary format support 2020-09-04 14:38:15 -03:00
pe-file.exe.debug perf tests: Add test for PE binary format support 2020-09-04 14:38:15 -03:00
perf-hooks.c
perf-record.c perf evlist: Use the right prefix for 'struct evlist' event attribute config methods 2020-11-30 15:15:27 -03:00
perf-targz-src-pkg
perf-time-to-tsc.c perf evlist: Use the right prefix for 'struct evlist' event attribute config methods 2020-11-30 15:15:27 -03:00
pfm.c perf tools: Add optional support for libpfm4 2020-05-29 16:51:38 -03:00
pmu-events.c perf test: Fix metric parsing test 2020-12-15 11:52:41 -03:00
pmu.c perf test: Free formats for perf pmu parse test 2020-09-15 09:22:42 -03:00
python-use.c perf tests: Show python test script in verbose mode 2020-10-13 16:22:03 -03:00
sample-parsing.c perf test: Fix unaligned access in sample parsing test 2021-02-18 16:08:29 -03:00
sdt.c perf tools: Pass build_id object to build_id__sprintf() 2020-10-14 08:46:22 -03:00
stat.c
sw-clock.c perf test: Fix cpu and thread map leaks in sw_clock_freq test 2021-03-06 16:54:28 -03:00
switch-tracking.c perf evlist: Use the right prefix for 'struct evlist' event attribute config methods 2020-11-30 15:15:27 -03:00
task-exit.c perf test: Fix cpu and thread map leaks in task_exit test 2021-03-06 16:54:28 -03:00
tests.h perf tools: Add OCaml demangling 2021-02-17 15:15:06 -03:00
thread-map.c
thread-maps-share.c
time-utils-test.c
topology.c perf stat aggregation: Add separate thread member 2020-12-24 10:05:28 -03:00
unit_number__scnprintf.c
vmlinux-kallsyms.c
wp.c perf test: Implement skip_reason callback for watchpoint tests 2020-11-04 09:42:40 -03:00