ESX avoid potential leaks

* src/esx/esx_driver.c: reorder some function calls to avoid potential
  virDomainPtr leaks
This commit is contained in:
Matthias Bolte 2009-09-14 12:44:33 +02:00 committed by Daniel Veillard
parent f98be4d35c
commit 847a7c7c2e

View File

@ -1047,14 +1047,14 @@ esxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
continue;
}
domain = virGetDomain(conn, name_candidate, uuid_candidate);
if (domain == NULL) {
if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
&powerState) < 0) {
goto failure;
}
if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
&powerState) < 0) {
domain = virGetDomain(conn, name_candidate, uuid_candidate);
if (domain == NULL) {
goto failure;
}
@ -1138,14 +1138,14 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
continue;
}
domain = virGetDomain(conn, name_candidate, uuid_candidate);
if (domain == NULL) {
if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
&powerState) < 0) {
goto failure;
}
if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
&powerState) < 0) {
domain = virGetDomain(conn, name_candidate, uuid_candidate);
if (domain == NULL) {
goto failure;
}