When group->index == 0, uninitialized variable path might get freed. Path is
always freed in the loop, so it is useless to free it before return.

Signed-off-by: Jan Safranek <jsafr...@redhat.com>
---

 src/api.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/src/api.c b/src/api.c
index 207d076..d68a4c8 100644
--- a/src/api.c
+++ b/src/api.c
@@ -1350,7 +1350,7 @@ int cgroup_modify_cgroup(struct cgroup *cgroup)
 {
        char *path, base[FILENAME_MAX];
        int i;
-       int error;
+       int error = 0;
        int ret;
 
        if (!cgroup_initialized)
@@ -1388,12 +1388,7 @@ int cgroup_modify_cgroup(struct cgroup *cgroup)
                                goto err;
                }
        }
-       if (path)
-               free(path);
-       return 0;
 err:
-       if (path)
-               free(path);
        return error;
 
 }


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to