]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
bhyvexml2xmltest: Avoid leaking driver caps
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 3 Feb 2026 13:00:59 +0000 (14:00 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 4 Feb 2026 07:29:38 +0000 (08:29 +0100)
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.

704 (288 direct, 416 indirect) bytes in 1 blocks are definitely lost in loss record 328 of 332
   at 0x4885098: calloc (vg_replace_malloc.c:1682)
   by 0x4EE35CA: g_malloc0 (in /usr/local/lib/libglib-2.0.so.0.8400.4)
   by 0x53314B8: g_type_create_instance (in /usr/local/lib/libgobject-2.0.so.0.8400.4)
   by 0x531A263: ??? (in /usr/local/lib/libgobject-2.0.so.0.8400.4)
   by 0x531975E: g_object_new (in /usr/local/lib/libgobject-2.0.so.0.8400.4)
   by 0x4AA9AB6: virObjectNew (virobject.c:252)
   by 0x4AF0BBA: virCapabilitiesNew (capabilities.c:87)
   by 0x401797B: virBhyveCapsBuild (bhyve_capabilities.c:51)
   by 0x4012F57: mymain (bhyvexml2xmltest.c:60)
   by 0x4016872: virTestMain (testutils.c:913)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
tests/bhyvexml2xmltest.c

index 5df1f2b6baee5407c0f2b3a552752985f4666e46..9e3bd6c45fc8f394ebc2ec574c71dfad6d475575 100644 (file)
@@ -144,6 +144,7 @@ mymain(void)
     /* USB xhci tablet */
     DO_TEST_DIFFERENT("input-xhci-tablet");
 
+    virObjectUnref(driver.caps);
     virTestSetHostArch(VIR_ARCH_AARCH64);
     driver.caps = virBhyveCapsBuild();
     /* bhyve does not support UTC clock on ARM */