[libvirt] [PATCH 4/5] vircgrouptest: Don't leak @cgroup

Michal Privoznik mprivozn at redhat.com
Thu Aug 10 07:29:09 UTC 2017


In these test cases we create internal representation of cgroup,
however, never free it.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tests/vircgrouptest.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
index b932b1ad5..1e551cfc7 100644
--- a/tests/vircgrouptest.c
+++ b/tests/vircgrouptest.c
@@ -353,6 +353,7 @@ static int testCgroupNewForPartitionNested(const void *args ATTRIBUTE_UNUSED)
     }
 
     /* Should now work */
+    virCgroupFree(&cgroup);
     if ((rv = virCgroupNewPartition("/deployment/production", true, -1, &cgroup)) != 0) {
         fprintf(stderr, "Failed to create /deployment/production cgroup: %d\n", -rv);
         goto cleanup;
@@ -401,12 +402,14 @@ static int testCgroupNewForPartitionNestedDeep(const void *args ATTRIBUTE_UNUSED
         goto cleanup;
     }
 
+    virCgroupFree(&cgroup);
     if ((rv = virCgroupNewPartition("/user/berrange.user", true, -1, &cgroup)) != 0) {
         fprintf(stderr, "Failed to create /user/berrange.user cgroup: %d\n", -rv);
         goto cleanup;
     }
 
     /* Should now work */
+    virCgroupFree(&cgroup);
     if ((rv = virCgroupNewPartition("/user/berrange.user/production", true, -1, &cgroup)) != 0) {
         fprintf(stderr, "Failed to create /user/berrange.user/production cgroup: %d\n", -rv);
         goto cleanup;
-- 
2.13.0




More information about the libvir-list mailing list