Hi,

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.


Thanks
Ken'ichi Ohmichi

Signed-off-by: Ken'ichi Ohmichi <[email protected]>
---
--- a/api.c     2009-03-30 12:14:42.000000000 +0900
+++ b/api.c     2009-03-30 12:15:13.000000000 +0900
@@ -589,8 +589,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);
                ret = EIO;
                goto unlock_exit;
        }

------------------------------------------------------------------------------
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to