public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] samples/bpf:fix fout leak
@ 2023-04-11  8:43 Hao Zeng
  2023-04-13 13:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Hao Zeng @ 2023-04-11  8:43 UTC (permalink / raw)
  To: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, bpf
  Cc: linux-kernel, Hao Zeng

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-13 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-11  8:43 [PATCH] samples/bpf:fix fout leak Hao Zeng
2023-04-13 13:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox