]> xenbits.xensource.com Git - libvirt.git/commitdiff
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByUUID
authorMatt Coleman <mcoleman@datto.com>
Thu, 21 Jan 2021 18:50:55 +0000 (13:50 -0500)
committerLaine Stump <laine@redhat.com>
Fri, 22 Jan 2021 19:04:25 +0000 (14:04 -0500)
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
src/hyperv/hyperv_driver.c

index e5a62c728bcab84ece3127c35364100405419e7b..fe1ab1c52c3cd57fb9741fa9550f9cf85d0e1965 100644 (file)
@@ -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;
 }