]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
fsx: fix leaked log file pointer
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Feb 2025 22:00:31 +0000 (14:00 -0800)
committerZorro Lang <zlang@kernel.org>
Tue, 18 Feb 2025 04:42:39 +0000 (12:42 +0800)
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>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
ltp/fsx.c

index d1b0f245582b315c4977591bca883d59d26bb538..163b9453b5418ba1c6a247f962fc5b83f4be7ef8 100644 (file)
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -3489,6 +3489,7 @@ main(int argc, char **argv)
        if (recordops)
                logdump();
 
+       fclose(fsxlogf);
        exit(0);
        return 0;
 }