1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

qemu: initialize variables in qemuParseCommandLine

Commit 6700062 introduced a jump to error which skipped the
initialization of def:

qemu/qemu_parse_command.c:1870:9: error: variable 'def' is
used uninitialized whenever 'if' condition is true
      [-Werror,-Wsometimes-uninitialized]
    if (!(qemuCaps = virQEMUCapsCacheLookup(capsCache, progargv[0])))

Initialize def to fix this warning and qemuCaps, to prevent
a future error like this.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Ján Tomko 2018-08-28 12:53:25 +02:00
parent 6700062fb0
commit ea119118fc

View File

@ -1838,7 +1838,7 @@ qemuParseCommandLine(virFileCachePtr capsCache,
virDomainChrSourceDefPtr *monConfig,
bool *monJSON)
{
virDomainDefPtr def;
virDomainDefPtr def = NULL;
size_t i;
bool nographics = false;
bool fullscreen = false;
@ -1852,7 +1852,7 @@ qemuParseCommandLine(virFileCachePtr capsCache,
virDomainDiskDefPtr disk = NULL;
const char *ceph_args = qemuFindEnv(progenv, "CEPH_ARGS");
bool have_sdl = false;
virQEMUCapsPtr qemuCaps;
virQEMUCapsPtr qemuCaps = NULL;
if (pidfile)
*pidfile = NULL;