summaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2008-02-24 00:24:10 +0100
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-24 02:13:24 +0100
commitf777073848ba3708d68d87e43f104f83316187d7 (patch)
tree4eb0e5e36e70165c4eb7d41673bacd70423a986d /kernel/cgroup.c
parentcgroup: clean up cgroup.h (diff)
downloadlinux-f777073848ba3708d68d87e43f104f83316187d7.tar.xz
linux-f777073848ba3708d68d87e43f104f83316187d7.zip
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 36066d8a4911..947fe3b22182 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;