From 958d6208a35c7eeef5ccb975b41e768c07e7e2ff Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 8 Jul 2016 23:45:22 +0200 Subject: [PATCH] qemuxml2argvtest: Don't leak dummy monitor 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 --- tests/qemuxml2argvtest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 45525a2818..2bfd1ca265 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);