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; continue;
} }
domain = virGetDomain(conn, name_candidate, uuid_candidate); if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
&powerState) < 0) {
if (domain == NULL) {
goto failure; goto failure;
} }
if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine, domain = virGetDomain(conn, name_candidate, uuid_candidate);
&powerState) < 0) {
if (domain == NULL) {
goto failure; goto failure;
} }
@@ -1138,14 +1138,14 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
continue; continue;
} }
domain = virGetDomain(conn, name_candidate, uuid_candidate); if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
&powerState) < 0) {
if (domain == NULL) {
goto failure; goto failure;
} }
if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine, domain = virGetDomain(conn, name_candidate, uuid_candidate);
&powerState) < 0) {
if (domain == NULL) {
goto failure; goto failure;
} }