Skip to content

Commit e4e2907

Browse files
captain5050acmel
authored andcommitted
perf stat: Fix memory leak on error path
strdup() is used to deduplicate, ensure it isn't leaking an already created string by freeing first. 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 4e88118 commit e4e2907

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/perf/util/stat-shadow.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ void perf_stat__collect_metric_expr(struct evlist *evsel_list)
444444
"Add %s event to groups to get metric expression for %s\n",
445445
metric_name,
446446
counter->name);
447+
free(printed);
447448
printed = strdup(metric_name);
448449
}
449450
invalid = true;

0 commit comments

Comments
 (0)