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
[ Upstream commit 23acb14 ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Hao Zeng authored and gregkh committed May 24, 2023
1 parent e2759a5 commit e3e6e25
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 @@ -308,6 +308,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 e3e6e25

Please sign in to comment.