iolog.c: Fix memory leak for blkparse case
[fio.git] / iolog.c
diff --git a/iolog.c b/iolog.c
index 5a41e93fa2644ab98e8a3cf5f24e308aaa05c5b1..a2cf0c1ccd6083ebf2b3c0d11686713238ad2983 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -631,8 +631,6 @@ static bool init_iolog_read(struct thread_data *td, char *fname)
        } else
                f = fopen(fname, "r");
 
-       free(fname);
-
        if (!f) {
                perror("fopen read iolog");
                return false;
@@ -719,6 +717,7 @@ bool init_iolog(struct thread_data *td)
                        td->io_log_blktrace = 0;
                        ret = init_iolog_read(td, fname);
                }
+               free(fname);
        } else if (td->o.write_iolog_file)
                ret = init_iolog_write(td);
        else