Fix double free of td zone state index
authorJens Axboe <axboe@fb.com>
Sat, 5 Mar 2016 02:50:41 +0000 (19:50 -0700)
committerJens Axboe <axboe@fb.com>
Sat, 5 Mar 2016 02:50:41 +0000 (19:50 -0700)
Signed-off-by: Jens Axboe <axboe@fb.com>
backend.c
options.c

index 6083a51e7e5478557b1f7c4f79fb84363cde1bbc..7f57c65ae64678d10f351db12abaa3cfe287d098 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -1711,6 +1711,15 @@ err:
        cgroup_shutdown(td, &cgroup_mnt);
        verify_free_state(td);
 
+       if (td->zone_state_index) {
+               int i;
+
+               for (i = 0; i < DDIR_RWDIR_CNT; i++)
+                       free(td->zone_state_index[i]);
+               free(td->zone_state_index);
+               td->zone_state_index = NULL;
+       }
+
        if (fio_option_is_set(o, cpumask)) {
                ret = fio_cpuset_exit(&o->cpumask);
                if (ret)
index 3ae090640bd1119c5561f2c5fbf49a2de439cb5d..bc2d0ed64219f26b961970a93727ae58ebfb5537 100644 (file)
--- a/options.c
+++ b/options.c
@@ -4417,14 +4417,6 @@ void fio_options_free(struct thread_data *td)
                free(td->eo);
                td->eo = NULL;
        }
-       if (td->zone_state_index) {
-               int i;
-
-               for (i = 0; i < DDIR_RWDIR_CNT; i++)
-                       free(td->zone_state_index[i]);
-               free(td->zone_state_index);
-               td->zone_state_index = NULL;
-       }
 }
 
 struct fio_option *fio_option_find(const char *name)