qemu: Fix coverity issues after refcount refactoring

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2014-12-23 05:32:45 +01:00
parent 3865941be1
commit 31354b5b32
2 changed files with 5 additions and 2 deletions

View File

@ -1516,7 +1516,8 @@ static virDomainPtr qemuDomainLookupByName(virConnectPtr conn,
if (dom) dom->id = vm->def->id;
cleanup:
virObjectUnlock(vm);
if (vm)
virObjectUnlock(vm);
return dom;
}

View File

@ -3101,7 +3101,9 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
VIR_FREE(xmlout);
VIR_FORCE_CLOSE(dataFD[0]);
VIR_FORCE_CLOSE(dataFD[1]);
if (ret < 0) {
if (ret < 0 && priv) {
/* priv is set right after vm is added to the list of domains
* and there is no 'goto cleanup;' in the middle of those */
virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
priv->nbdPort = 0;
qemuDomainRemoveInactive(driver, vm);