[PATCH 4/5] qemuxml2argvtest: Don't leak dummy monitor

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

 



It's just test, but why leak it?

==26971== 20 bytes in 1 blocks are definitely lost in loss record 623 of 704
==26971==    at 0x4C29F80: malloc (vg_replace_malloc.c:296)
==26971==    by 0xE560447: vasprintf (vasprintf.c:76)
==26971==    by 0xAE0DEE2: virVasprintfInternal (virstring.c:480)
==26971==    by 0xAE0DFF7: virAsprintfInternal (virstring.c:501)
==26971==    by 0x4751F3: qemuProcessPrepareMonitorChr (qemu_process.c:2651)
==26971==    by 0x4334B1: testCompareXMLToArgvFiles (qemuxml2argvtest.c:297)
==26971==    by 0x4339AC: testCompareXMLToArgvHelper (qemuxml2argvtest.c:413)
==26971==    by 0x446E7A: virTestRun (testutils.c:179)
==26971==    by 0x445D33: mymain (qemuxml2argvtest.c:2029)
==26971==    by 0x44886F: virTestMain (testutils.c:969)
==26971==    by 0x445D9B: main (qemuxml2argvtest.c:2036)

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/qemuxml2argvtest.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 45525a2..2bfd1ca 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -265,6 +265,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
     size_t i;
     qemuDomainObjPrivatePtr priv = NULL;
 
+    memset(&monitor_chr, 0, sizeof(monitor_chr));
+
     if (!(conn = virGetConnect()))
         goto out;
     conn->secretDriver = &fakeSecretDriver;
@@ -292,8 +294,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
 
     vm->def->id = -1;
 
-
-    memset(&monitor_chr, 0, sizeof(monitor_chr));
     if (qemuProcessPrepareMonitorChr(&monitor_chr, priv->libDir) < 0)
         goto out;
 
@@ -363,6 +363,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
  out:
     VIR_FREE(log);
     VIR_FREE(actualargv);
+    virDomainChrSourceDefClear(&monitor_chr);
     virCommandFree(cmd);
     virObjectUnref(vm);
     virObjectUnref(conn);
-- 
2.8.4

--
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]