From: Michal Privoznik <mprivozn@redhat.com>
The firmwareDir member of driver config is set at the beginning
of mymain(). But then, roughly in the middle of test cases it is
overwritten to fakefirmwareemptydir. But this means the old value
must be freed. Or reassigned back to its original variable which
is freed automatically.
16 bytes in 1 blocks are definitely lost in loss record 190 of 505
at 0x4883224: malloc (vg_replace_malloc.c:451)
by 0x4EE6562: g_malloc (in /usr/local/lib/libglib-2.0.so.0.8400.4)
by 0x4F0100F: g_strdup (in /usr/local/lib/libglib-2.0.so.0.8400.4)
by 0x4013E26: g_strdup_inline (gstrfuncs.h:321)
by 0x4013E26: mymain (bhyvexml2argvtest.c:151)
by 0x40189A2: virTestMain (testutils.c:913)
by 0x4013DE6: main (bhyvexml2argvtest.c:354)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
tests/bhyvexml2argvtest.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index 8f078f9d78..ae43445cde 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -249,7 +249,8 @@ mymain(void)
DO_TEST("isa-controller");
DO_TEST_FAILURE("isa-multiple-controllers");
DO_TEST("firmware-efi");
- driver.config->firmwareDir = fakefirmwareemptydir;
+ fakefirmwaredir = g_steal_pointer(&driver.config->firmwareDir);
+ driver.config->firmwareDir = g_steal_pointer(&fakefirmwareemptydir);
DO_TEST_PREPARE_ERROR("firmware-efi");
DO_TEST("fs-9p");
DO_TEST("fs-9p-readonly");
--
2.52.0