Commit 4a18ab46 authored by zhaimingbing's avatar zhaimingbing Committed by Arnaldo Carvalho de Melo

perf lock: Fix a memory leak on an error path

if a strdup-ed string is NULL,the allocated memory needs freeing.
Signed-off-by: default avatarzhaimingbing <zhaimingbing@cmss.chinamobile.com>
Acked-by: default avatarIngo Molnar <mingo@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Li Dong <lidong@vivo.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20231124092657.10392-1-zhaimingbing@cmss.chinamobile.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a24d9d9d
......@@ -2285,8 +2285,10 @@ static int __cmd_record(int argc, const char **argv)
else
ev_name = strdup(contention_tracepoints[j].name);
if (!ev_name)
if (!ev_name) {
free(rec_argv);
return -ENOMEM;
}
rec_argv[i++] = "-e";
rec_argv[i++] = ev_name;
......
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