[PATCH] Be nicer about cleaning up allocated memory
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/log.c b/log.c
index 51eaee6..91ac083 100644
--- a/log.c
+++ b/log.c
@@ -170,11 +170,15 @@
int init_iolog(struct thread_data *td)
{
- if (td->read_iolog)
- return init_iolog_read(td);
- else if (td->write_iolog)
- return init_iolog_write(td);
+ int ret = 0;
+ if (td->read_iolog)
+ ret = init_iolog_read(td);
+ else if (td->write_iolog)
+ ret = init_iolog_write(td);
+
+ free(td->iolog_file);
+ td->iolog_file = NULL;
return 0;
}