From: Lukas Straub Date: Wed, 19 Jan 2022 21:14:40 +0000 (+0000) Subject: iolog.c: Fix memory leak for blkparse case X-Git-Tag: fio-3.30~86 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=3a3e5c6e7606e727df1788a73d04db56d77ba00d iolog.c: Fix memory leak for blkparse case init_blkparse_read (load_blkparse previously) didn't free the filename. Fix this by freeing it in the init_iolog function and handling it for both init_iolog_read and init_blkparse_read. Signed-off-by: Lukas Straub Link: https://lore.kernel.org/r/e4acf183ab789b7284bfa96089ebe1256e15f98d.1642626314.git.lukasstraub2@web.de Signed-off-by: Jens Axboe --- diff --git a/iolog.c b/iolog.c index 5a41e93f..a2cf0c1c 100644 --- 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