diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/perf/builtin-record.c | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-stat.c | 4 | ||||
| -rw-r--r-- | tools/perf/builtin-top.c | 4 | ||||
| -rw-r--r-- | tools/perf/perf.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/parse-events.c | 11 | ||||
| -rw-r--r-- | tools/perf/util/parse-events.h | 1 |
6 files changed, 16 insertions, 8 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index e68aee33bc1..052de1780f7 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
| @@ -965,8 +965,6 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) | |||
| 965 | out_free_event_array: | 965 | out_free_event_array: |
| 966 | free(event_array); | 966 | free(event_array); |
| 967 | out_free_fd: | 967 | out_free_fd: |
| 968 | list_for_each_entry(pos, &evsel_list, node) | ||
| 969 | perf_evsel__free_fd(pos); | ||
| 970 | free(all_tids); | 968 | free(all_tids); |
| 971 | all_tids = NULL; | 969 | all_tids = NULL; |
| 972 | out_symbol_exit: | 970 | out_symbol_exit: |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 3e5f356a524..589ba3a9242 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
| @@ -844,10 +844,8 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used) | |||
| 844 | if (status != -1) | 844 | if (status != -1) |
| 845 | print_stat(argc, argv); | 845 | print_stat(argc, argv); |
| 846 | out_free_fd: | 846 | out_free_fd: |
| 847 | list_for_each_entry(pos, &evsel_list, node) { | 847 | list_for_each_entry(pos, &evsel_list, node) |
| 848 | perf_evsel__free_fd(pos); | ||
| 849 | perf_evsel__free_stat_priv(pos); | 848 | perf_evsel__free_stat_priv(pos); |
| 850 | } | ||
| 851 | out: | 849 | out: |
| 852 | return status; | 850 | return status; |
| 853 | } | 851 | } |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 13a836efa1e..27b9c14a0a0 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
| @@ -1495,10 +1495,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __used) | |||
| 1495 | 1495 | ||
| 1496 | status = __cmd_top(); | 1496 | status = __cmd_top(); |
| 1497 | out_free_fd: | 1497 | out_free_fd: |
| 1498 | list_for_each_entry(pos, &evsel_list, node) { | 1498 | list_for_each_entry(pos, &evsel_list, node) |
| 1499 | perf_evsel__free_fd(pos); | ||
| 1500 | perf_evsel__free_mmap(pos); | 1499 | perf_evsel__free_mmap(pos); |
| 1501 | } | ||
| 1502 | 1500 | ||
| 1503 | return status; | 1501 | return status; |
| 1504 | } | 1502 | } |
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 595d0f4a710..5b1ecd66bb3 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
| @@ -286,6 +286,8 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv) | |||
| 286 | status = p->fn(argc, argv, prefix); | 286 | status = p->fn(argc, argv, prefix); |
| 287 | exit_browser(status); | 287 | exit_browser(status); |
| 288 | 288 | ||
| 289 | perf_evsel_list__delete(); | ||
| 290 | |||
| 289 | if (status) | 291 | if (status) |
| 290 | return status & 0xff; | 292 | return status & 0xff; |
| 291 | 293 | ||
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 2d948ad471f..3a142e90d60 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
| @@ -982,3 +982,14 @@ int perf_evsel_list__create_default(void) | |||
| 982 | ++nr_counters; | 982 | ++nr_counters; |
| 983 | return 0; | 983 | return 0; |
| 984 | } | 984 | } |
| 985 | |||
| 986 | void perf_evsel_list__delete(void) | ||
| 987 | { | ||
| 988 | struct perf_evsel *pos, *n; | ||
| 989 | |||
| 990 | list_for_each_entry_safe(pos, n, &evsel_list, node) { | ||
| 991 | list_del_init(&pos->node); | ||
| 992 | perf_evsel__delete(pos); | ||
| 993 | } | ||
| 994 | nr_counters = 0; | ||
| 995 | } | ||
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 0f915a01a3f..0a0abc1d10e 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
| @@ -12,6 +12,7 @@ struct perf_evsel; | |||
| 12 | extern struct list_head evsel_list; | 12 | extern struct list_head evsel_list; |
| 13 | 13 | ||
| 14 | int perf_evsel_list__create_default(void); | 14 | int perf_evsel_list__create_default(void); |
| 15 | void perf_evsel_list__delete(void); | ||
| 15 | 16 | ||
| 16 | struct option; | 17 | struct option; |
| 17 | 18 | ||
