[PATCH 8/8] iolog.c: Fix memory leak for blkparse case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <lukasstraub2@xxxxxx>
---
 iolog.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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
-- 
2.34.1

Attachment: pgpU8pe9xI50K.pgp
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux