aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNamhyung Kim <[email protected]>2024-07-31 16:55:01 -0700
committerArnaldo Carvalho de Melo <[email protected]>2024-08-01 18:55:55 -0300
commit3da209bb1177462b6fe8e3021a5527a5a49a9336 (patch)
tree1ce719c1d6384f67938acc904a1fdde6ebc9b4e9
parent96465e0179fa8a7059bd48a81a81889dcad7d543 (diff)
perf mem: Free the allocated sort string, fixing a leak
The get_sort_order() returns either a new string (from strdup) or NULL but it never gets freed. Signed-off-by: Namhyung Kim <[email protected]> Fixes: 2e7f545096f954a9 ("perf mem: Factor out a function to generate sort order") Cc: Adrian Hunter <[email protected]> Cc: Athira Rajeev <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Added Fixes tag ] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/builtin-mem.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 863fcd735dae..93413cfcd585 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -372,6 +372,7 @@ static int report_events(int argc, const char **argv, struct perf_mem *mem)
rep_argv[i] = argv[j];
ret = cmd_report(i, rep_argv);
+ free(new_sort_order);
free(rep_argv);
return ret;
}