From: Peter Krempa Date: Wed, 22 Sep 2021 08:52:23 +0000 (+0200) Subject: testCompareXMLToArgv: Avoid use of uninitialized 'monitor_chr' X-Git-Tag: v7.8.0-rc1~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bb7b3aa9cca12620717b8fa4e830349904054a7;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Ján Tomko --- diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index f0cfca014c..675537b05d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -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;