Commit 3da209bb authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

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: default avatarNamhyung Kim <namhyung@kernel.org>
Fixes: 2e7f5450 ("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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 96465e01
...@@ -372,6 +372,7 @@ static int report_events(int argc, const char **argv, struct perf_mem *mem) ...@@ -372,6 +372,7 @@ static int report_events(int argc, const char **argv, struct perf_mem *mem)
rep_argv[i] = argv[j]; rep_argv[i] = argv[j];
ret = cmd_report(i, rep_argv); ret = cmd_report(i, rep_argv);
free(new_sort_order);
free(rep_argv); free(rep_argv);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment