Skip to content

Commit 69fd218

Browse files
chudihuangyonghong-song
authored andcommitted
libbpf-tools/klockstat.c: fix delete elem bug when reset stats
1 parent d4e505c commit 69fd218

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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)