Signed-off-by: Ismo Puustinen <ismo.puusti...@intel.com>

diff --git a/src/config.c b/src/config.c
index da2c0dd..3edd0a3 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1659,7 +1659,7 @@ int cgroup_config_create_template_group(struct cgroup 
*cgroup,
                /* no template is present for given name x controller pair
                 * add controller to result cgroup */
                aux_cgroup = cgroup_new_cgroup(cgroup->name);
-               if (aux_cgroup) {
+               if (aux_cgroup == NULL) {
                        ret = ECGINVAL;
                        fprintf(stderr, "cgroup %s can't be created\n",
                                cgroup->name);
@@ -1671,6 +1671,7 @@ int cgroup_config_create_template_group(struct cgroup 
*cgroup,
                        ret = ECGINVAL;
                        fprintf(stderr, "cgroup %s can't be created\n",
                                cgroup->name);
+                       cgroup_free(&aux_cgroup);
                        goto end;
                }
                ret = cgroup_create_cgroup(aux_cgroup, flags);
@@ -1678,6 +1679,7 @@ int cgroup_config_create_template_group(struct cgroup 
*cgroup,
                        ret = ECGINVAL;
                        fprintf(stderr, "cgroup %s can't be created\n",
                                cgroup->name);
+                       cgroup_free(&aux_cgroup);
                        goto end;
                }
        }
-- 
2.4.3


------------------------------------------------------------------------------
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to