From: Jan Safranek Date: Wed, 24 Aug 2011 09:41:34 +0000 (+0200) Subject: tests: Fixed memory leak in test_functions X-Git-Tag: v0.38~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f265fe52c5b97df5931a54bebc47d87b4c859005;p=thirdparty%2Flibcgroup.git tests: Fixed memory leak in test_functions Free the cgroup on error. Signed-off-by: Jan Safranek Acked-by: Dhaval Giani --- diff --git a/tests/test_functions.c b/tests/test_functions.c index 796a2af8..8f1d59e1 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 {