1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

testCompareXMLToArgv: Avoid use of uninitialized 'monitor_chr'

Failure of 'testQemuInfoInitArgs' jumps over the initialization of
'monitor_chr' via memset, which leads to a crash.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-09-22 10:52:23 +02:00
parent f5d8913f91
commit 1bb7b3aa9c

View File

@ -642,14 +642,14 @@ testCompareXMLToArgv(const void *data)
virArch arch = VIR_ARCH_NONE;
g_autoptr(virIdentity) sysident = virIdentityGetSystem();
memset(&monitor_chr, 0, sizeof(monitor_chr));
if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0)
goto cleanup;
if (info->arch != VIR_ARCH_NONE && info->arch != VIR_ARCH_X86_64)
qemuTestSetHostArch(&driver, info->arch);
memset(&monitor_chr, 0, sizeof(monitor_chr));
if (!(conn = virGetConnect()))
goto cleanup;