[PATCH] samples/bpf: Fix outf leak in hbm's read_trace_pipe2

Hu Xiaoying posted 1 patch 2 years, 7 months ago
samples/bpf/hbm.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] samples/bpf: Fix outf leak in hbm's read_trace_pipe2
Posted by Hu Xiaoying 2 years, 7 months ago
Fix outf being fopen'ed but then not subsequently fclose'd. In the affected
branch, outf is otherwise going out of scope.
---
 samples/bpf/hbm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/samples/bpf/hbm.c b/samples/bpf/hbm.c
index bf66277115e2..e28370741d9b 100644
--- a/samples/bpf/hbm.c
+++ b/samples/bpf/hbm.c
@@ -105,6 +105,8 @@ static void read_trace_pipe2(void)
 			}
 		}
 	}
+
+	fclose(outf);
 }
 
 static void do_error(char *msg, bool errno_flag)
-- 
2.25.1