bhyvexml2argvtest: Avoid leaking driver caps

Driver capabilities are allocated at the beginning of mymain(),
but roughly in the middle the architecture is switched to aarch64
and capabilities are constructed again. Without freeing the old
ones.

1,583 (288 direct, 1,295 indirect) bytes in 1 blocks are definitely lost in loss record 520 of 536
   at 0x4888098: calloc (vg_replace_malloc.c:1682)
   by 0x4EE65CA: g_malloc0 (in /usr/local/lib/libglib-2.0.so.0.8400.4)
   by 0x53344B8: g_type_create_instance (in /usr/local/lib/libgobject-2.0.so.0.8400.4)
   by 0x531D263: ??? (in /usr/local/lib/libgobject-2.0.so.0.8400.4)
   by 0x531C75E: g_object_new (in /usr/local/lib/libgobject-2.0.so.0.8400.4)
   by 0x4AAC806: virObjectNew (virobject.c:252)
   by 0x4AF366A: virCapabilitiesNew (capabilities.c:87)
   by 0x401998B: virBhyveCapsBuild (bhyve_capabilities.c:51)
   by 0x4013E93: mymain (bhyvexml2argvtest.c:155)
   by 0x4018882: virTestMain (testutils.c:913)
   by 0x4013DC6: main (bhyvexml2argvtest.c:351)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
This commit is contained in:
Michal Privoznik committed 2026-02-04 08:29:38 +01:00
1 parent fcc5910557
commit f0af542077
1 file changed
+1
+1
View File
@@ -331,6 +331,7 @@ mymain(void)
DO_TEST("bhyveload-timeout");
/* arm64 tests */
virObjectUnref(driver.caps);
virTestSetHostArch(VIR_ARCH_AARCH64);
driver.caps = virBhyveCapsBuild();
/* bhyve does not support UTC clock on ARM */