perf hist: Add missing puts to hist__account_cycles
[ Upstream commit c1149037f65bcf0334886180ebe3d5efcf214912 ]
Caught using reference count checking on perf top with
"--call-graph=lbr". After this no memory leaks were detected.
Fixes: 57849998e2
("perf report: Add processing for cycle histograms")
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: James Clark <james.clark@arm.com>
Cc: Nick Terrell <terrelln@fb.com>
Cc: Sean Christopherson <seanjc@google.com>
Cc: Changbin Du <changbin.du@huawei.com>
Cc: liuwenyu <liuwenyu7@huawei.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Song Liu <song@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Yanteng Si <siyanteng@loongson.cn>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Link: https://lore.kernel.org/r/20231024222353.3024098-6-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
4e66bde5c7
commit
a83fc293ac
@@ -2624,8 +2624,6 @@ void hist__account_cycles(struct branch_stack *bs, struct addr_location *al,
|
|||||||
|
|
||||||
/* If we have branch cycles always annotate them. */
|
/* If we have branch cycles always annotate them. */
|
||||||
if (bs && bs->nr && entries[0].flags.cycles) {
|
if (bs && bs->nr && entries[0].flags.cycles) {
|
||||||
int i;
|
|
||||||
|
|
||||||
bi = sample__resolve_bstack(sample, al);
|
bi = sample__resolve_bstack(sample, al);
|
||||||
if (bi) {
|
if (bi) {
|
||||||
struct addr_map_symbol *prev = NULL;
|
struct addr_map_symbol *prev = NULL;
|
||||||
@@ -2640,7 +2638,7 @@ void hist__account_cycles(struct branch_stack *bs, struct addr_location *al,
|
|||||||
* Note that perf stores branches reversed from
|
* Note that perf stores branches reversed from
|
||||||
* program order!
|
* program order!
|
||||||
*/
|
*/
|
||||||
for (i = bs->nr - 1; i >= 0; i--) {
|
for (int i = bs->nr - 1; i >= 0; i--) {
|
||||||
addr_map_symbol__account_cycles(&bi[i].from,
|
addr_map_symbol__account_cycles(&bi[i].from,
|
||||||
nonany_branch_mode ? NULL : prev,
|
nonany_branch_mode ? NULL : prev,
|
||||||
bi[i].flags.cycles);
|
bi[i].flags.cycles);
|
||||||
@@ -2649,6 +2647,12 @@ void hist__account_cycles(struct branch_stack *bs, struct addr_location *al,
|
|||||||
if (total_cycles)
|
if (total_cycles)
|
||||||
*total_cycles += bi[i].flags.cycles;
|
*total_cycles += bi[i].flags.cycles;
|
||||||
}
|
}
|
||||||
|
for (unsigned int i = 0; i < bs->nr; i++) {
|
||||||
|
map__put(bi[i].to.ms.map);
|
||||||
|
maps__put(bi[i].to.ms.maps);
|
||||||
|
map__put(bi[i].from.ms.map);
|
||||||
|
maps__put(bi[i].from.ms.maps);
|
||||||
|
}
|
||||||
free(bi);
|
free(bi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user