iolog: fix leak for unsupported iolog version
authorJens Axboe <axboe@kernel.dk>
Wed, 3 Oct 2018 18:29:46 +0000 (12:29 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 3 Oct 2018 18:29:46 +0000 (12:29 -0600)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
iolog.c

diff --git a/iolog.c b/iolog.c
index 2f06289..b72dcf9 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -634,18 +634,18 @@ static bool init_iolog_read(struct thread_data *td)
                return false;
        }
 
-       td->io_log_rfile = f;
-
        /*
         * version 2 of the iolog stores a specific string as the
         * first line, check for that
         */
        if (!strncmp(iolog_ver2, buffer, strlen(iolog_ver2))) {
                free_release_files(td);
+               td->io_log_rfile = f;
                return read_iolog2(td);
        }
 
        log_err("fio: iolog version 1 is no longer supported\n");
+       fclose(f);
        return false;
 }