summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-mem.c
diff options
context:
space:
mode:
authorMartin Kepplinger <martink@posteo.de>2017-09-13 22:14:19 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-10 15:40:43 +0300
commit6d29ae49cd31597586835fd22957adba5368cdb1 (patch)
tree7c7f90b1f6bcca302651cf0aecc6af83aca77ede /tools/perf/builtin-mem.c
parentcf33c88d64557ab627eca91c79c8a7891a9ba9d4 (diff)
downloadlinux-6d29ae49cd31597586835fd22957adba5368cdb1.tar.xz
perf tools: Fix leaking rec_argv in error cases
[ Upstream commit c896f85a7c15ab9d040ffac8b8003e47996602a2 ] Let's free the allocated rec_argv in case we return early, in order to avoid leaking memory. This adds free() at a few very similar places across the tree where it was missing. Signed-off-by: Martin Kepplinger <martink@posteo.de> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Martin kepplinger <martink@posteo.de> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20170913191419.29806-1-martink@posteo.de Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/perf/builtin-mem.c')
-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 4db960085273..e15efba605f6 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -113,6 +113,7 @@ static int __cmd_record(int argc, const char **argv, struct perf_mem *mem)
if (!perf_mem_events[j].supported) {
pr_err("failed: event '%s' not supported\n",
perf_mem_events__name(j));
+ free(rec_argv);
return -1;
}