]> git.baikalelectronics.ru Git - kernel.git/commitdiff
perf trace: Free strings in trace__parse_events_option()
authorRiccardo Mancini <rickyman7@gmail.com>
Thu, 15 Jul 2021 16:07:23 +0000 (18:07 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 15 Jul 2021 20:35:57 +0000 (17:35 -0300)
ASan reports several memory leaks running:

  # perf test "88: Check open filename arg using perf trace + vfs_getname"

The fourth of these leaks is related to some strings never being freed
in trace__parse_events_option.

This patch adds the missing frees.

Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/34d08535b11124106b859790549991abff5a7de8.1626343282.git.rickyman7@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-trace.c

index 0d9e58190f15b5236facbe2e257d03252d9a484b..9c265fa96011f712162a049d264c1fdee8ff29cf 100644 (file)
@@ -4659,6 +4659,9 @@ do_concat:
                err = parse_events_option(&o, lists[0], 0);
        }
 out:
+       free(strace_groups_dir);
+       free(lists[0]);
+       free(lists[1]);
        if (sep)
                *sep = ',';