]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: fix use-after-free in cgmanager.
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 8 Jun 2015 15:33:22 +0000 (10:33 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 14 Aug 2015 17:17:20 +0000 (13:17 -0400)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/cgmanager.c

index 2ae7bae72f4d65fccd1d405ecf2c378e80c28c73..bc61950abe8179f70450741a79748490f3ffb810 100644 (file)
@@ -1243,8 +1243,10 @@ static bool collect_subsytems(void)
                }
        }
        fclose(f);
+       f = NULL;
 
        free(line);
+       line = NULL;
 
 collected:
        if (!nr_subsystems) {
@@ -1257,8 +1259,10 @@ collected:
        if (!cgroup_use && errno != 0)
                goto out_good;
        if (cgroup_use) {
-               if (!verify_and_prune(cgroup_use))
-                       goto out_free;
+               if (!verify_and_prune(cgroup_use)) {
+                       free_subsystems();
+                       return false;
+               }
                subsystems_inone[0] = NIH_MUST( strdup(cgroup_use) );
                cgm_all_controllers_same = false;
        }