qemuxml2argvtest: Don't initialize qemuCaps twice

There's no point in calling testInitQEMUCaps() (which sets
info.qemuCaps) only to overwrite (and leak) it on the very next
line.

==12962== 296 (208 direct, 88 indirect) bytes in 1 blocks are definitely lost in loss record 265 of 331
==12962==    at 0x4C2CF26: calloc (vg_replace_malloc.c:711)
==12962==    by 0x5D28D9F: virAllocVar (viralloc.c:560)
==12962==    by 0x5D96AB4: virObjectNew (virobject.c:239)
==12962==    by 0x56DB7C7: virQEMUCapsNew (qemu_capabilities.c:1480)
==12962==    by 0x112A5B: testInitQEMUCaps (qemuxml2argvtest.c:361)
==12962==    by 0x1371C8: mymain (qemuxml2argvtest.c:2871)
==12962==    by 0x13AD0B: virTestMain (testutils.c:1120)
==12962==    by 0x1372FD: main (qemuxml2argvtest.c:2883)

Removing the function call renders @gic argument unused therefore
it's removed from the macro (and all its callers).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2018-05-30 17:51:59 +02:00
parent 5f18b9ba8d
commit 879cff55ac

View File

@ -692,15 +692,13 @@ mymain(void)
* version.
*/
# define DO_TEST_CAPS_INTERNAL(name, suffix, migrateFrom, flags, parseFlags, \
gic, arch, capsfile) \
arch, capsfile) \
do { \
static struct testInfo info = { \
name, "." suffix, NULL, migrateFrom, migrateFrom ? 7 : -1,\
(flags), parseFlags, false, NULL \
}; \
info.skipLegacyCPUs = skipLegacyCPUs; \
if (testInitQEMUCaps(&info, gic) < 0) \
return EXIT_FAILURE; \
if (!(info.qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(arch), \
capsfile))) \
return EXIT_FAILURE; \
@ -713,18 +711,18 @@ mymain(void)
# define TEST_CAPS_PATH abs_srcdir "/qemucapabilitiesdata/caps_"
# define DO_TEST_CAPS_ARCH_VER_FULL(name, flags, parseFlags, gic, arch, ver) \
DO_TEST_CAPS_INTERNAL(name, arch "-" ver, NULL, flags, parseFlags, gic, \
# define DO_TEST_CAPS_ARCH_VER_FULL(name, flags, parseFlags, arch, ver) \
DO_TEST_CAPS_INTERNAL(name, arch "-" ver, NULL, flags, parseFlags, \
arch, TEST_CAPS_PATH ver "." arch ".xml")
# define DO_TEST_CAPS_ARCH_VER(name, gic, arch, ver) \
DO_TEST_CAPS_ARCH_VER_FULL(name, 0, 0, gic, arch, ver)
# define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \
DO_TEST_CAPS_ARCH_VER_FULL(name, 0, 0, arch, ver)
# define DO_TEST_CAPS_VER(name, ver) \
DO_TEST_CAPS_ARCH_VER(name, GIC_NONE, "x86_64", ver)
DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver)
# define DO_TEST_CAPS_LATEST(name) \
DO_TEST_CAPS_INTERNAL(name, "x86_64-latest", NULL, 0, 0, GIC_NONE, "x86_64", \
DO_TEST_CAPS_INTERNAL(name, "x86_64-latest", NULL, 0, 0, "x86_64", \
capslatest_x86_64)
/**