perf record: Fixup return path of cmd_record()
[linux-3.10.git] / tools / perf / builtin-record.c
index 80cc3ea..9f2344a 100644 (file)
@@ -1028,7 +1028,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
                ui__error("%s", errbuf);
 
                err = -saved_errno;
-               goto out_free_fd;
+               goto out_symbol_exit;
        }
 
        err = -ENOMEM;
@@ -1059,6 +1059,9 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
        }
 
        err = __cmd_record(&record, argc, argv);
+
+       perf_evlist__munmap(evsel_list);
+       perf_evlist__close(evsel_list);
 out_free_fd:
        perf_evlist__delete_maps(evsel_list);
 out_symbol_exit: