mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
bhyvexml2argvtest: Don't leak parts of driver config
At the beginning of mymain() the virBhyveDriverConfigNew() is called which inits driver config with some paths. These are then overwritten to produce stable test output. Well, the old ones should be freed first. 128 bytes in 1 blocks are definitely lost in loss record 453 of 508 at 0x4883224: malloc (vg_replace_malloc.c:451) by 0x506BD16: vasprintf_l (in /lib/libc.so.7) by 0x4F39073: g_vasprintf (in /usr/local/lib/libglib-2.0.so.0.8400.4) by 0x4F01288: g_strdup_printf (in /usr/local/lib/libglib-2.0.so.0.8400.4) by 0x401F75B: virBhyveDriverConfigNew (bhyve_conf.c:62) by 0x4013FAA: mymain (bhyvexml2argvtest.c:164) by 0x4018892: virTestMain (testutils.c:913) by 0x4013DC6: main (bhyvexml2argvtest.c:352) 25 bytes in 1 blocks are definitely lost in loss record 206 of 508 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 0x401F715: g_strdup_inline (gstrfuncs.h:321) by 0x401F715: virBhyveDriverConfigNew (bhyve_conf.c:60) by 0x4013FAA: mymain (bhyvexml2argvtest.c:164) by 0x4018892: virTestMain (testutils.c:913) by 0x4013DC6: main (bhyvexml2argvtest.c:352) Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
This commit is contained in:
1 parent
f0af542077
commit
210cae66e0
1 file changed
+4
-2
@@ -164,8 +164,10 @@ mymain(void)
|
||||
if (!(driver.config = virBhyveDriverConfigNew()))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
driver.config->firmwareDir = fakefirmwaredir;
|
||||
driver.config->nvramDir = fakenvramdir;
|
||||
VIR_FREE(driver.config->firmwareDir);
|
||||
VIR_FREE(driver.config->nvramDir);
|
||||
driver.config->firmwareDir = g_steal_pointer(&fakefirmwaredir);
|
||||
driver.config->nvramDir = g_steal_pointer(&fakenvramdir);
|
||||
driver.config->bhyveloadTimeout = 0;
|
||||
driver.config->bhyveloadTimeoutKill = 0;
|
||||
|
||||
|
||||
Reference in new issue
Block a user