Skip to content

Commit

Permalink
libbpf-tools/klockstat.c: fix delete elem bug when reset stats
Browse files Browse the repository at this point in the history
  • Loading branch information
chudihuang authored and yonghong-song committed Jun 16, 2024
1 parent d4e505c commit 69fd218
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libbpf-tools/klockstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,10 @@ static int print_stats(struct ksyms *ksyms, int stack_map, int stat_map)
}

for (i = 0; i < stat_idx; i++) {
if (env.reset)
if (env.reset) {
ss = stats[i];
bpf_map_delete_elem(stat_map, &ss->stack_id);
}
free(stats[i]);
}
free(stats);
Expand Down

0 comments on commit 69fd218

Please sign in to comment.