Skip to content

Commit

Permalink
cgroup.c: fix memory leak at cgroup init failed
Browse files Browse the repository at this point in the history
Signed-off-by: LiFeng <lifeng68@huawei.com>
  • Loading branch information
lifeng68 authored and Christian Brauner committed Mar 2, 2020
1 parent 7a28653 commit 9db4328
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lxc/cgroups/cgroup.c
Expand Up @@ -31,9 +31,11 @@ struct cgroup_ops *cgroup_init(struct lxc_conf *conf)
if (!cgroup_ops)
return log_error_errno(NULL, errno, "Failed to initialize cgroup driver");

if (cgroup_ops->data_init(cgroup_ops))
if (cgroup_ops->data_init(cgroup_ops)) {
cgroup_exit(cgroup_ops);
return log_error_errno(NULL, errno,
"Failed to initialize cgroup data");
}

TRACE("Initialized cgroup driver %s", cgroup_ops->driver);

Expand Down

0 comments on commit 9db4328

Please sign in to comment.