[PATCH 2/4] tests: Call virCommandFree() in cleanup section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix a potential memory leak by calling virCommandFree() in the cleanup
section.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>
---
 tests/commandtest.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/commandtest.c b/tests/commandtest.c
index 991c0572b0..dfd15a2079 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -1219,8 +1219,6 @@ static int test27(const void *unused ATTRIBUTE_UNUSED)
         goto cleanup;
     }
 
-    virCommandFree(cmd);
-
     if (!outactual || !erractual)
         goto cleanup;
 
@@ -1236,6 +1234,7 @@ static int test27(const void *unused ATTRIBUTE_UNUSED)
     ret = 0;
 
  cleanup:
+    virCommandFree(cmd);
     VIR_FORCE_CLOSE(pipe1[0]);
     VIR_FORCE_CLOSE(pipe2[0]);
     VIR_FORCE_CLOSE(pipe1[1]);
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux