mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
perf metric: Fix memory leaks
Certain error paths may leak memory as caught by address sanitizer.
Ensure this is cleaned up to make sure address/leak sanitizer is happy.
Fixes: 5ecd5a0c7d
("perf metrics: Modify setup and deduplication")
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20211107090002.3784612-3-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
07eafd4e05
commit
aba8c5e380
@ -228,6 +228,7 @@ static void metric__free(struct metric *m)
|
||||
free(m->metric_refs);
|
||||
expr__ctx_free(m->pctx);
|
||||
free((char *)m->modifier);
|
||||
evlist__delete(m->evlist);
|
||||
free(m);
|
||||
}
|
||||
|
||||
@ -1482,8 +1483,10 @@ static int parse_groups(struct evlist *perf_evlist, const char *str,
|
||||
}
|
||||
|
||||
|
||||
if (combined_evlist)
|
||||
if (combined_evlist) {
|
||||
evlist__splice_list_tail(perf_evlist, &combined_evlist->core.entries);
|
||||
evlist__delete(combined_evlist);
|
||||
}
|
||||
|
||||
list_for_each_entry(m, &metric_list, nd) {
|
||||
if (m->evlist)
|
||||
|
Loading…
Reference in New Issue
Block a user