Skip to content

Commit

Permalink
coverity: fix use-after-free in cgmanager.
Browse files Browse the repository at this point in the history
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
hallyn authored and stgraber committed Jul 1, 2015
1 parent 8b9ff68 commit 67c573f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/lxc/cgmanager.c
Expand Up @@ -1258,8 +1258,10 @@ static bool collect_subsytems(void)
}
}
fclose(f);
f = NULL;

free(line);
line = NULL;

collected:
if (!nr_subsystems) {
Expand All @@ -1272,8 +1274,10 @@ static bool collect_subsytems(void)
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;
}
Expand Down

0 comments on commit 67c573f

Please sign in to comment.