]> git.baikalelectronics.ru Git - kernel.git/commit
perf sched: Fix memory leaks in __cmd_record detected with -fsanitize=address
authorIan Rogers <irogers@google.com>
Wed, 24 Aug 2022 14:57:33 +0000 (07:57 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 27 Aug 2022 14:55:17 +0000 (11:55 -0300)
commit4773d3c76dda4928bce9a83fcc0165cc5bb322d8
tree8e9361351a2af3014dfb2835395bb3e1d118fbf9
parentfa85d9c143546ee297daa568ead6d886ac43c67b
perf sched: Fix memory leaks in __cmd_record detected with -fsanitize=address

An array of strings is passed to cmd_record but not freed. As
cmd_record modifies the array, add another array as a copy that can be
mutated allowing the original array contents to all be freed.

Detected with -fsanitize=address.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20220824145733.409005-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-sched.c