]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tests: Fixed memory leak in test_functions
authorJan Safranek <jsafrane@redhat.com>
Wed, 24 Aug 2011 09:41:34 +0000 (11:41 +0200)
committerJan Safranek <jsafrane@redhat.com>
Wed, 14 Sep 2011 11:24:41 +0000 (13:24 +0200)
Free the cgroup on error.

Signed-off-by: Jan Safranek <jsafrane@redhat.com>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
tests/test_functions.c

index 796a2af8d78cff2ac6a1ad9498dac4ca57dbf669..8f1d59e1d27af6dc0cc170fb3492570859c3e16c 100644 (file)
@@ -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 {