[PATCH] Plug a few more leaks
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index 818394a0859846690389408ffd15a75124b66fd0..f81aec599a6a6709be28f205c094a20a86e6bfdf 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -424,14 +424,6 @@ static void do_io(struct thread_data *td)
        }
 }
 
-static int td_io_init(struct thread_data *td)
-{
-       if (td->io_ops->init)
-               return td->io_ops->init(td);
-
-       return 0;
-}
-
 static void cleanup_io_u(struct thread_data *td)
 {
        struct list_head *entry, *n;
@@ -594,8 +586,14 @@ static void *thread_main(void *data)
        if (init_random_state(td))
                goto err;
 
-       if (td->ioscheduler && switch_ioscheduler(td))
-               goto err;
+       if (td->ioscheduler) {
+               int ret = switch_ioscheduler(td);
+
+               free(td->ioscheduler);
+               free(td->sysfs_root);
+               if (ret)
+                       goto err;
+       }
 
        td_set_runstate(td, TD_INITIALIZED);
        fio_sem_up(&startup_sem);
@@ -606,8 +604,10 @@ static void *thread_main(void *data)
 
        gettimeofday(&td->epoch, NULL);
 
-       if (td->exec_prerun)
+       if (td->exec_prerun) {
                system(td->exec_prerun);
+               free(td->exec_prerun);
+       }
 
        while (td->loops--) {
                getrusage(RUSAGE_SELF, &td->ru_start);
@@ -656,8 +656,10 @@ static void *thread_main(void *data)
                finish_log(td, td->clat_log, "clat");
        if (td->write_iolog)
                write_iolog_close(td);
-       if (td->exec_postrun)
+       if (td->exec_postrun) {
                system(td->exec_postrun);
+               free(td->exec_postrun);
+       }
 
        if (exitall_on_terminate)
                terminate_threads(td->groupid);