diff options
author | Hao Zeng <zenghao@kylinos.cn> | 2023-04-11 16:43:49 +0800 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2023-04-13 15:08:45 +0200 |
commit | 23acb14af1914010dd0aae1bbb7fab28bf518b8e (patch) | |
tree | 189633740deeb90027a1df8c0cd583b25e3801d8 /samples | |
parent | 1ba83f505c53d35eda892ac7f108ef1189da6fa8 (diff) | |
download | lwn-23acb14af1914010dd0aae1bbb7fab28bf518b8e.tar.gz lwn-23acb14af1914010dd0aae1bbb7fab28bf518b8e.zip |
samples/bpf: Fix fout leak in hbm's run_bpf_prog
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
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 ff58ec43f56a..6448b7826107 100644 --- a/samples/bpf/hbm.c +++ b/samples/bpf/hbm.c @@ -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 - |