Skip to content

Commit aba8c5e

Browse files
captain5050acmel
authored andcommitted
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: 5ecd5a0 ("perf metrics: Modify setup and deduplication") Signed-off-by: Ian Rogers <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 07eafd4 commit aba8c5e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/perf/util/metricgroup.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ static void metric__free(struct metric *m)
228228
free(m->metric_refs);
229229
expr__ctx_free(m->pctx);
230230
free((char *)m->modifier);
231+
evlist__delete(m->evlist);
231232
free(m);
232233
}
233234

@@ -1482,8 +1483,10 @@ static int parse_groups(struct evlist *perf_evlist, const char *str,
14821483
}
14831484

14841485

1485-
if (combined_evlist)
1486+
if (combined_evlist) {
14861487
evlist__splice_list_tail(perf_evlist, &combined_evlist->core.entries);
1488+
evlist__delete(combined_evlist);
1489+
}
14871490

14881491
list_for_each_entry(m, &metric_list, nd) {
14891492
if (m->evlist)

0 commit comments

Comments
 (0)