From: Li Zefan Date: Sat, 23 Feb 2008 23:24:10 +0000 (-0800) Subject: cgroup: fix memory leak in cgroup_get_sb() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f777073848ba3708d68d87e43f104f83316187d7;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 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;