[PATCH 14/55] hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByID

Matt Coleman mcoleman at datto.com
Thu Jan 21 18:50:54 UTC 2021


Signed-off-by: Matt Coleman <matt at datto.com>
---
 src/hyperv/hyperv_driver.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 45463d120d..e5a62c728b 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -1654,16 +1654,13 @@ hypervDomainLookupByID(virConnectPtr conn, int id)
 {
     virDomainPtr domain = NULL;
     hypervPrivate *priv = conn->privateData;
-    Msvm_ComputerSystem *computerSystem = NULL;
+    g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
 
     if (hypervGetVirtualSystemByID(priv, id, &computerSystem) < 0)
-        goto cleanup;
+        return NULL;
 
     hypervMsvmComputerSystemToDomain(conn, computerSystem, &domain);
 
- cleanup:
-    hypervFreeObject((hypervObject *)computerSystem);
-
     return domain;
 }
 
-- 
2.30.0





More information about the libvir-list mailing list