summaryrefslogtreecommitdiff
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2008-02-23 15:24:10 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-23 17:13:24 -0800
commitf777073848ba3708d68d87e43f104f83316187d7 (patch)
tree4eb0e5e36e70165c4eb7d41673bacd70423a986d /kernel/cgroup.c
parentffd2d883399cbbb641e55730676ce1ec4845d99d (diff)
cgroup: fix memory leak in cgroup_get_sb()
opts.release_agent is not kfree()ed in all necessary places. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Paul Menage <menage@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 36066d8a491..947fe3b2218 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -954,8 +954,11 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
}
root = kzalloc(sizeof(*root), GFP_KERNEL);
- if (!root)
+ if (!root) {
+ if (opts.release_agent)
+ kfree(opts.release_agent);
return -ENOMEM;
+ }
init_cgroup_root(root);
root->subsys_bits = opts.subsys_bits;