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 6083a51..7f57c65 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 3ae0906..bc2d0ed 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)