]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ESX avoid potential leaks
authorMatthias Bolte <matthias.bolte@googlemail.com>
Mon, 14 Sep 2009 10:44:33 +0000 (12:44 +0200)
committerDaniel Veillard <veillard@redhat.com>
Mon, 14 Sep 2009 10:44:33 +0000 (12:44 +0200)
* src/esx/esx_driver.c: reorder some function calls to avoid potential
  virDomainPtr leaks

src/esx/esx_driver.c

index 8d1af7150c7f5999d91c1eb574ff470410425fc8..f91d48dc90d24059d1c68d9c054c6a1b7779a81b 100644 (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;
         }