]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByName
authorMatt Coleman <mcoleman@datto.com>
Thu, 21 Jan 2021 18:50:56 +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 fe1ab1c52c3cd57fb9741fa9550f9cf85d0e1965..dd5c42c45b0e67969215b8aecd97514820a0a6bc 100644 (file)
@@ -1689,23 +1689,20 @@ hypervDomainLookupByName(virConnectPtr conn, const char *name)
 {
     virDomainPtr domain = NULL;
     hypervPrivate *priv = conn->privateData;
-    Msvm_ComputerSystem *computerSystem = NULL;
+    g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
 
     if (hypervGetVirtualSystemByName(priv, name, &computerSystem) < 0)
-        goto cleanup;
+        return NULL;
 
     if (computerSystem->next) {
         virReportError(VIR_ERR_MULTIPLE_DOMAINS,
                        _("Multiple domains exist with the name '%s': repeat the request using a UUID"),
                        name);
-        goto cleanup;
+        return NULL;
     }
 
     hypervMsvmComputerSystemToDomain(conn, computerSystem, &domain);
 
- cleanup:
-    hypervFreeObject((hypervObject *)computerSystem);
-
     return domain;
 }