xen: Resolve Coverity FORWARD_NULL issue

Commit '18b14012' refactored the Xen code resulting in a Coverity
warning about possible NULL reference if the path where the XM driver
takes puts the def on it's list.  Moved/duplicated the virGetDomain()
call to pacify the possible NULL deref.
This commit is contained in:
John Ferlan 2013-05-23 11:07:36 -04:00
parent e4de214b38
commit 677981d1be

View File

@ -1656,13 +1656,14 @@ xenUnifiedDomainDefineXML(virConnectPtr conn, const char *xml)
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
if (xenXMDomainDefineXML(conn, def) < 0)
goto cleanup;
ret = virGetDomain(conn, def->name, def->uuid);
def = NULL; /* XM driver owns it now */
} else {
if (xenDaemonDomainDefineXML(conn, def) < 0)
goto cleanup;
ret = virGetDomain(conn, def->name, def->uuid);
}
ret = virGetDomain(conn, def->name, def->uuid);
if (ret)
ret->id = -1;