]> Pileus Git - ~andy/linux/blobdiff - tools/perf/tests/code-reading.c
perf evlist: Close fds on destructor
[~andy/linux] / tools / perf / tests / code-reading.c
index 85d4919dd62313e64ee508d08cb47b255c4ce0f0..2c0ce723749f4597b298d9552826193e584411f4 100644 (file)
@@ -391,7 +391,7 @@ static int do_test_code_reading(bool try_kcore)
        struct machines machines;
        struct machine *machine;
        struct thread *thread;
-       struct perf_record_opts opts = {
+       struct record_opts opts = {
                .mmap_pages          = UINT_MAX,
                .user_freq           = UINT_MAX,
                .user_interval       = ULLONG_MAX,
@@ -541,13 +541,11 @@ static int do_test_code_reading(bool try_kcore)
 out_err:
        if (evlist) {
                perf_evlist__munmap(evlist);
-               perf_evlist__close(evlist);
                perf_evlist__delete(evlist);
-       }
-       if (cpus)
+       } else {
                cpu_map__delete(cpus);
-       if (threads)
                thread_map__delete(threads);
+       }
        machines__destroy_kernel_maps(&machines);
        machine__delete_threads(machine);
        machines__exit(&machines);