Skip to content

Commit 16ef987

Browse files
chudihuangdagomez137
authored andcommitted
libbpf-tools/klockstat.c: fix delete elem bug when reset stats
1 parent 6a4f58b commit 16ef987

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

libbpf-tools/klockstat.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,10 @@ static int print_stats(struct ksyms *ksyms, int stack_map, int stat_map)
570570
}
571571

572572
for (i = 0; i < stat_idx; i++) {
573-
if (env.reset)
573+
if (env.reset) {
574+
ss = stats[i];
574575
bpf_map_delete_elem(stat_map, &ss->stack_id);
576+
}
575577
free(stats[i]);
576578
}
577579
free(stats);

0 commit comments

Comments
 (0)