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

Message ID 20230629013444.50350-1-huxiaoying@kylinos.cn
State New
Headers
Series samples/bpf: Fix outf leak in hbm's read_trace_pipe2 |

Commit Message

Tom Hu June 29, 2023, 1:34 a.m. UTC
  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(+)
  

Patch

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)