Skip to content

Commit 4bfb4d2

Browse files
Hao Zengsmb49
authored andcommitted
samples/bpf: Fix fout leak in hbm's run_bpf_prog
BugLink: https://bugs.launchpad.net/bugs/2028808 [ 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> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent b8bc592 commit 4bfb4d2

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

samples/bpf/hbm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ static int run_bpf_prog(char *prog, int cg_id)
315315
fout = fopen(fname, "w");
316316
fprintf(fout, "id:%d\n", cg_id);
317317
fprintf(fout, "ERROR: Could not lookup queue_stats\n");
318+
fclose(fout);
318319
} else if (stats_flag && qstats.lastPacketTime >
319320
qstats.firstPacketTime) {
320321
long long delta_us = (qstats.lastPacketTime -

0 commit comments

Comments
 (0)