[libvirt] ESX [11/12]: Reorder some function calls to avoid potential virDomainPtr leaks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* src/esx/esx_driver.c: avoid potential virDomainPtr leaks
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 5a93d1f..91de407 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1200,14 +1200,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;
         }
 
@@ -1291,14 +1291,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;
         }
 
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]