diff options
author | Hao Zeng <zenghao@kylinos.cn> | 2023-04-11 16:43:49 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-05-30 12:44:03 +0100 |
commit | a7ec2f424f6edad34651137783a0a59eca9aa37e (patch) | |
tree | 43bcfebe6cac852a0cfd97c1255a232a072d8e08 /samples | |
parent | 4ceedc2f8bdffb82e40b7d1bb912304f8e157cb1 (diff) |
samples/bpf: Fix fout leak in hbm's run_bpf_prog
[ Upstream commit 23acb14af1914010dd0aae1bbb7fab28bf518b8e ]
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>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/bpf/hbm.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/samples/bpf/hbm.c b/samples/bpf/hbm.c index e0fbab9bec83..6d6d4e4ea843 100644 --- a/samples/bpf/hbm.c +++ b/samples/bpf/hbm.c @@ -307,6 +307,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 - |