]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuxml2argvtest: Don't initialize qemuCaps twice
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 30 May 2018 15:51:59 +0000 (17:51 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 31 May 2018 09:33:45 +0000 (11:33 +0200)
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>
tests/qemuxml2argvtest.c

index ddd2b88c0a875972828e95e4d1f017aceac66916..a6a40e273e9b6b8286b06d21060ddab230e60ce0 100644 (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)
 
 /**