From db183fafc710a0272ba6fa89a6d3188e5ca9a13a Mon Sep 17 00:00:00 2001 From: Dhaval Giani Date: Tue, 16 Nov 2010 14:29:51 +0100 Subject: [PATCH] v2 [patch 6/6] api: Fix cgroup_walk_tree_begin memory leak As pointed out by Steve Grubb at http://article.gmane.org/gmane.comp.lib.libcg.devel/2485 we leak entry in cgroup_walk_tree_begin When we fail fts_read, we need to ensure that entry is freed on return. Do so. Reported-by: Steve Grubb Signed-off-by: Dhaval Giani Acked-By: Jan Safranek --- src/api.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api.c b/src/api.c index e34c928e..a51230bd 100644 --- a/src/api.c +++ b/src/api.c @@ -2839,6 +2839,7 @@ int cgroup_walk_tree_begin(const char *controller, const char *base_path, ent = fts_read(entry->fts); if (!ent) { cgroup_dbg("fts_read failed\n"); + free(entry); return ECGINVAL; } if (!*base_level && depth) -- 2.47.2