[libvirt] [PATCH 1/4] tests: plug memory leaks

Eric Blake eblake at redhat.com
Fri Dec 10 19:17:58 UTC 2010


* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Don't
allocate, since we don't use virDomainChrDefFree.
---

Makes it easier to run valgrind on qemuxml2argv to spot the leaks
in libvirt proper.

 tests/qemuxml2argvtest.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index db2d006..5387432 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -86,8 +86,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
     monitor_chr.type = VIR_DOMAIN_CHR_TYPE_UNIX;
     monitor_chr.data.nix.path = (char *)"/tmp/test-monitor";
     monitor_chr.data.nix.listen = 1;
-    if (!(monitor_chr.info.alias = strdup("monitor")))
-        goto fail;
+    monitor_chr.info.alias = (char *)"monitor";

     flags = QEMUD_CMD_FLAG_VNC_COLON |
         QEMUD_CMD_FLAG_NO_REBOOT |
-- 
1.7.3.2




More information about the libvir-list mailing list