smalloc: oom cleanups
[fio.git] / backend.c
index a92b1e3c025e1f7f2d4a5500a669f6bea0f7166e..fc83ed178a05eca587570d7de5495a0182930c3f 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -2477,7 +2477,8 @@ int fio_backend(struct sk_out *sk_out)
        helper_thread_create(startup_sem, sk_out);
 
        cgroup_list = smalloc(sizeof(*cgroup_list));
-       INIT_FLIST_HEAD(cgroup_list);
+       if (cgroup_list)
+               INIT_FLIST_HEAD(cgroup_list);
 
        run_threads(sk_out);
 
@@ -2507,8 +2508,10 @@ int fio_backend(struct sk_out *sk_out)
        }
 
        free_disk_util();
-       cgroup_kill(cgroup_list);
-       sfree(cgroup_list);
+       if (cgroup_list) {
+               cgroup_kill(cgroup_list);
+               sfree(cgroup_list);
+       }
        sfree(cgroup_mnt);
 
        fio_sem_remove(startup_sem);