From: Li Zefan Date: Sat, 23 Feb 2008 23:24:10 +0000 (-0800) Subject: cgroup: fix memory leak in cgroup_get_sb() X-Git-Tag: v2.6.25-rc3~22 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f777073848ba3708d68d87e43f104f83316187d7;p=linux-2.6 cgroup: fix memory leak in cgroup_get_sb() opts.release_agent is not kfree()ed in all necessary places. Signed-off-by: Li Zefan Acked-by: Paul Menage Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 36066d8a49..947fe3b221 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;