aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2008-02-23 18:24:10 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-23 20:13:24 -0500
commitf777073848ba3708d68d87e43f104f83316187d7 (patch)
tree4eb0e5e36e70165c4eb7d41673bacd70423a986d
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>
-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,
954 } 954 }
955 955
956 root = kzalloc(sizeof(*root), GFP_KERNEL); 956 root = kzalloc(sizeof(*root), GFP_KERNEL);
957 if (!root) 957 if (!root) {
958 if (opts.release_agent)
959 kfree(opts.release_agent);
958 return -ENOMEM; 960 return -ENOMEM;
961 }
959 962
960 init_cgroup_root(root); 963 init_cgroup_root(root);
961 root->subsys_bits = opts.subsys_bits; 964 root->subsys_bits = opts.subsys_bits;