]> git.proxmox.com Git - mirror_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)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 8 Jun 2015 15:33:22 +0000 (10:33 -0500)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/cgmanager.c

index 6df530ca535ff3340615bc5a6f9faadce4cff755..c143beab95b403aa7a66e5c55c641b10da4c96e6 100644 (file)
@@ -1258,8 +1258,10 @@ static bool collect_subsytems(void)
                }
        }
        fclose(f);
+       f = NULL;
 
        free(line);
+       line = NULL;
 
 collected:
        if (!nr_subsystems) {
@@ -1272,8 +1274,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;
        }