Skip to content

Commit

Permalink
cgroup: fix memory leak in cgroup_get_sb()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Li Zefan authored and Linus Torvalds committed Feb 24, 2008
1 parent ffd2d88 commit f777073
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f777073

Please sign in to comment.