[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 b3d4434e126b46b96356db78cfbf289ae8cc0659..8cf9ea25eb6127f675c5a16d4a4d02a9ecf6d596 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);
        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);
        }
        printf("\r");
        fflush(stdout);
-       free(eta_secs);
 }
 
 void print_status_init(int thread_number)
 }
 
 void print_status_init(int thread_number)
diff --git a/fio.c b/fio.c
index bdfbd827806502d5ee85e721b753d4dcb3683748..f81aec599a6a6709be28f205c094a20a86e6bfdf 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);
                int ret = switch_ioscheduler(td);
 
                free(td->ioscheduler);
+               free(td->sysfs_root);
                if (ret)
                        goto err;
        }
                if (ret)
                        goto err;
        }
diff --git a/stat.c b/stat.c
index fc0abe0a82b573742d781fa6cde65fc768f9d105..518d14dd13ad43dbe1dbfe02b6e83aec0a802eda 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -243,7 +243,9 @@ void init_disk_util(struct thread_data *td)
                sprintf(foo, "%s", tmp);
        }
 
                sprintf(foo, "%s", tmp);
        }
 
-       td->sysfs_root = strdup(foo);
+       if (td->ioscheduler)
+               td->sysfs_root = strdup(foo);
+
        disk_util_add(dev, foo);
 }
 
        disk_util_add(dev, foo);
 }
 
@@ -524,6 +526,8 @@ void show_run_stats(void)
 
                show_disk_util();
        }
 
                show_disk_util();
        }
+
+       free(runstats);
 }
 
 static inline void add_stat_sample(struct io_stat *is, unsigned long val)
 }
 
 static inline void add_stat_sample(struct io_stat *is, unsigned long val)