From c47ee042c61d050b70e6b90aa50848d82e77b041 Mon Sep 17 00:00:00 2001 From: Ken'ichi Ohmichi Date: Tue, 31 Mar 2009 11:05:26 +0900 Subject: Add free() call for error handling. I reviewed the libcgroup code in the viewpoint of memory-leak and found a lack of free(). This patch adds a free() call for error handling. Signed-off-by: Ken'ichi Ohmichi Signed-off-by: Dhaval Giani --- src/api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api.c b/src/api.c index d31cf4d..2d57351 100644 --- a/src/api.c +++ b/src/api.c @@ -590,8 +590,8 @@ int cgroup_init() ret = ECGOTHER; goto unlock_exit; } - buf = fgets(buf, FILENAME_MAX, proc_cgroup); - if (!buf) { + if (!fgets(buf, FILENAME_MAX, proc_cgroup)) { + free(buf); last_errno = errno; ret = ECGOTHER; goto unlock_exit; -- cgit