[PATCH] Plug a few more leaks fio-1.7
authorJens Axboe <jens.axboe@oracle.com>
Fri, 20 Oct 2006 12:00:36 +0000 (14:00 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 20 Oct 2006 12:00:36 +0000 (14:00 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
eta.c
fio.c
stat.c

diff --git a/eta.c b/eta.c
index b3d4434..8cf9ea2 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -215,6 +215,8 @@ void print_thread_status(void)
                }
        }
 
+       free(eta_secs);
+
        if (eta_sec != INT_MAX && elapsed) {
                perc = (double) elapsed / (double) (elapsed + eta_sec);
                eta_to_str(eta_str, eta_sec);
@@ -232,7 +234,6 @@ void print_thread_status(void)
        }
        printf("\r");
        fflush(stdout);
-       free(eta_secs);
 }
 
 void print_status_init(int thread_number)
diff --git a/fio.c b/fio.c
index bdfbd82..f81aec5 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -590,6 +590,7 @@ static void *thread_main(void *data)
                int ret = switch_ioscheduler(td);
 
                free(td->ioscheduler);
+               free(td->sysfs_root);
                if (ret)
                        goto err;
        }
diff --git a/stat.c b/stat.c
index fc0abe0..518d14d 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -243,7 +243,9 @@ void init_disk_util(struct thread_data *td)
                sprintf(foo, "%s", tmp);
        }
 
-       td->sysfs_root = strdup(foo);
+       if (td->ioscheduler)
+               td->sysfs_root = strdup(foo);
+
        disk_util_add(dev, foo);
 }
 
@@ -524,6 +526,8 @@ void show_run_stats(void)
 
                show_disk_util();
        }
+
+       free(runstats);
 }
 
 static inline void add_stat_sample(struct io_stat *is, unsigned long val)