c/r: check that cgroup_num_hierarchies > 0

Otherwise in the error case, we end up subtracting two from the
static_args, which would lead to a segfault :)

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
This commit is contained in:
Tycho Andersen 2016-09-16 20:26:31 -06:00
parent a0c91fccd9
commit 09e80d0cc4

View File

@ -191,7 +191,8 @@ static void exec_criu(struct criu_opts *opts)
return;
}
static_args += 2 * cgroup_num_hierarchies();
if (cgroup_num_hierarchies() > 0)
static_args += 2 * cgroup_num_hierarchies();
if (opts->user->verbose)
static_args++;