[PATCH 15/55] hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByUUID

Matt Coleman mcoleman at datto.com
Thu Jan 21 18:50:55 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 e5a62c728b..fe1ab1c52c 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -1671,18 +1671,15 @@ hypervDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
     virDomainPtr domain = NULL;
     hypervPrivate *priv = conn->privateData;
     char uuid_string[VIR_UUID_STRING_BUFLEN];
-    Msvm_ComputerSystem *computerSystem = NULL;
+    g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
 
     virUUIDFormat(uuid, uuid_string);
 
     if (hypervMsvmComputerSystemFromUUID(priv, uuid_string, &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