mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
perf header: Fix memory leaks in process_cpu_domain_info()
do_read_string() returns a string in allocated memory, for some reason
there was unused memory allocations and unnecessary strdups.
Remove these and make the "perf annotate basic tests" leak sanitizer
clean.
Fixes: d40c68a49f ("perf header: Support CPU DOMAIN relation info")
Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Aditya Bodkhe <aditya.b1@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Julia Lawall <Julia.Lawall@inria.fr>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Krzysztof Łopatowski <krzysztof.m.lopatowski@gmail.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-csky@vger.kernel.org
Cc: linux-riscv@lists.infradead.org
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sergei Trofimovich <slyich@gmail.com>
Cc: Shimin Guo <shimin.guo@skydio.com>
Cc: Suchit Karunakaran <suchitkarunakaran@gmail.com>
Cc: Swapnil Sapkal <swapnil.sapkal@amd.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Tianyou Li <tianyou.li@intel.com>
Cc: Will Deacon <will@kernel.org>
Cc: Zecheng Li <zecheng@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
800af362d6
commit
d84f24c898
|
|
@ -3634,6 +3634,7 @@ static int process_cpu_domain_info(struct feat_fd *ff, void *data __maybe_unused
|
|||
if (!d_info)
|
||||
return -1;
|
||||
|
||||
assert(cd_map[cpu]->domains[domain] == NULL);
|
||||
cd_map[cpu]->domains[domain] = d_info;
|
||||
d_info->domain = domain;
|
||||
|
||||
|
|
@ -3642,30 +3643,20 @@ static int process_cpu_domain_info(struct feat_fd *ff, void *data __maybe_unused
|
|||
if (!dname)
|
||||
return -1;
|
||||
|
||||
d_info->dname = zalloc(strlen(dname) + 1);
|
||||
if (!d_info->dname)
|
||||
return -1;
|
||||
|
||||
d_info->dname = strdup(dname);
|
||||
d_info->dname = dname;
|
||||
}
|
||||
|
||||
cpumask = do_read_string(ff);
|
||||
if (!cpumask)
|
||||
return -1;
|
||||
|
||||
d_info->cpumask = zalloc(strlen(cpumask) + 1);
|
||||
if (!d_info->cpumask)
|
||||
return -1;
|
||||
d_info->cpumask = strdup(cpumask);
|
||||
d_info->cpumask = cpumask;
|
||||
|
||||
cpulist = do_read_string(ff);
|
||||
if (!cpulist)
|
||||
return -1;
|
||||
|
||||
d_info->cpulist = zalloc(strlen(cpulist) + 1);
|
||||
if (!d_info->cpulist)
|
||||
return -1;
|
||||
d_info->cpulist = strdup(cpulist);
|
||||
d_info->cpulist = cpulist;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user