[PATCH] samples/bpf:fix fout leak

Hao Zeng posted 1 patch 2 years, 10 months ago
samples/bpf/hbm.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] samples/bpf:fix fout leak
Posted by Hao Zeng 2 years, 10 months ago
Fix fout fopen but not fclose

Signed-off-by: Hao Zeng <zenghao@kylinos.cn>
---
 samples/bpf/hbm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/samples/bpf/hbm.c b/samples/bpf/hbm.c
index 516fbac28b71..7f89700a17b6 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 -
-- 
2.37.2


No virus found
		Checked by Hillstone Network AntiVirus
Re: [PATCH] samples/bpf:fix fout leak
Posted by patchwork-bot+netdevbpf@kernel.org 2 years, 10 months ago
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Tue, 11 Apr 2023 16:43:49 +0800 you wrote:
> Fix fout fopen but not fclose
> 
> Signed-off-by: Hao Zeng <zenghao@kylinos.cn>
> ---
>  samples/bpf/hbm.c | 1 +
>  1 file changed, 1 insertion(+)

Here is the summary with links:
  - samples/bpf:fix fout leak
    https://git.kernel.org/bpf/bpf-next/c/23acb14af191

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html