[PATCH 13/55] hyperv: use g_autoptr for Msvm_ComputerSystem in hypervConnectListDomains

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

 



Signed-off-by: Matt Coleman <matt@xxxxxxxxx>
---
 src/hyperv/hyperv_driver.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index efafe9ece2..45463d120d 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -1606,9 +1606,8 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
 static int
 hypervConnectListDomains(virConnectPtr conn, int *ids, int maxids)
 {
-    bool success = false;
     hypervPrivate *priv = conn->privateData;
-    Msvm_ComputerSystem *computerSystemList = NULL;
+    g_autoptr(Msvm_ComputerSystem) computerSystemList = NULL;
     Msvm_ComputerSystem *computerSystem = NULL;
     int count = 0;
 
@@ -1616,7 +1615,7 @@ hypervConnectListDomains(virConnectPtr conn, int *ids, int maxids)
         return 0;
 
     if (hypervGetActiveVirtualSystemList(priv, &computerSystemList) < 0)
-        goto cleanup;
+        return -1;
 
     for (computerSystem = computerSystemList; computerSystem != NULL;
          computerSystem = computerSystem->next) {
@@ -1626,12 +1625,7 @@ hypervConnectListDomains(virConnectPtr conn, int *ids, int maxids)
             break;
     }
 
-    success = true;
-
- cleanup:
-    hypervFreeObject((hypervObject *)computerSystemList);
-
-    return success ? count : -1;
+    return count;
 }
 
 
-- 
2.30.0





[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]

  Powered by Linux