public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/7] cgroup: fix memory leak in cgroup_get_sb()
@ 2008-02-18  5:49 Li Zefan
  2008-02-20  3:04 ` Paul Menage
  0 siblings, 1 reply; 2+ messages in thread
From: Li Zefan @ 2008-02-18  5:49 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Paul Menage, KAMEZAWA Hiroyuki, LKML, containers

opts.release_agent is not kfree()ed in all necessary places.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 kernel/cgroup.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 0c35022..aa76bbd 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -961,8 +961,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;
-- 
1.5.4.rc3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-20  3:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-18  5:49 [PATCH 4/7] cgroup: fix memory leak in cgroup_get_sb() Li Zefan
2008-02-20  3:04 ` Paul Menage

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox