Free the cgroup on error.

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

 tests/test_functions.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tests/test_functions.c b/tests/test_functions.c
index 796a2af..8f1d59e 100644
--- a/tests/test_functions.c
+++ b/tests/test_functions.c
@@ -552,12 +552,14 @@ struct cgroup *new_cgroup(char *group, char 
*controller_name,
                        } else {
                                message(i++, FAIL, wr, retval ,
                                                         info[NOMESSAGE]);
+                               cgroup_free(&newcgroup);
                                return NULL;
                        }
                 } else {
                        /* Since these wrappers do not return an int so -1 */
                        message(i++, FAIL, "add_controller", -1,
                                                         info[NOMESSAGE]);
+                       cgroup_free(&newcgroup);
                        return NULL;
                }
        } else {


------------------------------------------------------------------------------
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