diff options
author | Namhyung Kim <namhyung@kernel.org> | 2024-07-31 16:55:01 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-10-04 16:29:23 +0200 |
commit | 1490a5dbd55f4b5bfccf6bbbcc7956c8f17e20ba (patch) | |
tree | 410b9616e1753ef86223991bfe609a7ea321e4f1 /tools | |
parent | a634fa8e480ac2423f86311a602f6295df2c8ed0 (diff) | |
download | linux-rpi-1490a5dbd55f4b5bfccf6bbbcc7956c8f17e20ba.tar.gz linux-rpi-1490a5dbd55f4b5bfccf6bbbcc7956c8f17e20ba.tar.bz2 linux-rpi-1490a5dbd55f4b5bfccf6bbbcc7956c8f17e20ba.zip |
perf mem: Free the allocated sort string, fixing a leak
[ Upstream commit 3da209bb1177462b6fe8e3021a5527a5a49a9336 ]
The get_sort_order() returns either a new string (from strdup) or NULL
but it never gets freed.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Fixes: 2e7f545096f954a9 ("perf mem: Factor out a function to generate sort order")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20240731235505.710436-3-namhyung@kernel.org
[ Added Fixes tag ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-mem.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index 51499c20da01..865f321d729b 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; } |