Skip to content

Commit

Permalink
samples/bpf: Fix fout leak in hbm's run_bpf_prog
Browse files Browse the repository at this point in the history
Fix fout being fopen'ed but then not subsequently fclose'd. In the affected
branch, fout is otherwise going out of scope.

Signed-off-by: Hao Zeng <zenghao@kylinos.cn>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20230411084349.1999628-1-zenghao@kylinos.cn
  • Loading branch information
Hao Zeng authored and Daniel Borkmann committed Apr 13, 2023
1 parent 1ba83f5 commit 23acb14
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions samples/bpf/hbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ static int run_bpf_prog(char *prog, int cg_id)
fout = fopen(fname, "w");
fprintf(fout, "id:%d\n", cg_id);
fprintf(fout, "ERROR: Could not lookup queue_stats\n");
fclose(fout);
} else if (stats_flag && qstats.lastPacketTime >
qstats.firstPacketTime) {
long long delta_us = (qstats.lastPacketTime -
Expand Down

0 comments on commit 23acb14

Please sign in to comment.