2023-06-29 02:01:26

by Tom Hu

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

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