diff mbox series

[22/23] fsx: fix leaked log file pointer

Message ID 173706974408.1927324.5268034153341516183.stgit@frogsfrogsfrogs (mailing list archive)
State New
Headers show
Series [01/23] generic/476: fix fsstress process management | expand

Commit Message

Darrick J. Wong Jan. 16, 2025, 11:30 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Fix a resource leaks in fsx, where we fail to close the fsx logfile,
because the C library could have some buffered contents that aren't
flushed when the program terminates.  glibc seems to do this for us, but
I wouldn't be so sure about the others.

Fixes: 3f742550dfed84 ("fsx: add support for recording operations to a file")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 ltp/fsx.c |    1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/ltp/fsx.c b/ltp/fsx.c
index 9efd2f5c86d11c..2c19fff880330a 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -3345,6 +3345,7 @@  main(int argc, char **argv)
 	if (recordops)
 		logdump();
 
+	fclose(fsxlogf);
 	exit(0);
 	return 0;
 }