perf tools: Fix leaking rec_argv in error cases
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>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
333b566559
commit
c896f85a7c
@@ -2732,6 +2732,7 @@ static int perf_c2c__record(int argc, const char **argv)
|
||||
if (!perf_mem_events[j].supported) {
|
||||
pr_err("failed: event '%s' not supported\n",
|
||||
perf_mem_events[j].name);
|
||||
free(rec_argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user