[libvirt] [PATCH 1/6] tests: fix some memleaks in tests

Zhang Bo oscar.zhangbo at huawei.com
Mon Apr 27 06:41:40 UTC 2015


Signed-off-by: Zhang Bo <oscar.zhangbo at huawei.com>
---
 tests/commandtest.c         | 1 +
 tests/domaincapstest.c      | 1 +
 tests/qemucommandutiltest.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/tests/commandtest.c b/tests/commandtest.c
index 6400ea2..f001a39 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -1081,6 +1081,7 @@ static int test24(const void *unused ATTRIBUTE_UNUSED)
     if (pidfile)
         unlink(pidfile);
     VIR_FREE(pidfile);
+    VIR_FREE(prefix);
     virCommandFree(cmd);
     VIR_FORCE_CLOSE(newfd1);
     /* coverity[double_close] */
diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c
index f6a060e..ecefdb9 100644
--- a/tests/domaincapstest.c
+++ b/tests/domaincapstest.c
@@ -242,6 +242,7 @@ mymain(void)
             ret = -1;                                                                   \
         } else if (virtTestRun(Filename, test_virDomainCapsFormat, &data) < 0)          \
             ret = -1;                                                                   \
+        virObjectUnref(qemuCaps);                                                             \
     } while (0)
 
     DO_TEST_QEMU("qemu_1.6.50-1", "caps_1.6.50-1", "/usr/bin/qemu-system-x86_64",
diff --git a/tests/qemucommandutiltest.c b/tests/qemucommandutiltest.c
index 8c52f02..bd457f8 100644
--- a/tests/qemucommandutiltest.c
+++ b/tests/qemucommandutiltest.c
@@ -66,6 +66,7 @@ testQemuCommandBuildObjectFromJSON(const void *opaque)
  cleanup:
     virJSONValueFree(val);
     VIR_FREE(result);
+    VIR_FREE(expect);
     return ret;
 }
 
-- 
1.7.12.4





More information about the libvir-list mailing list