]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainDeviceValidateAliasImpl: Automatically free GHashTable and remove cleanup
authorPeter Krempa <pkrempa@redhat.com>
Tue, 30 Nov 2021 10:33:52 +0000 (11:33 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 1 Dec 2021 12:53:11 +0000 (13:53 +0100)
After the conversion to g_autofree, the cleanup label is no longer
needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/conf/domain_validate.c

index 80401cf8c737692f16ede020fd920789a1813008..a4271f12479ff28d7b41bde81ef3a284e983ab4d 100644 (file)
@@ -1360,28 +1360,23 @@ static int
 virDomainDeviceValidateAliasImpl(const virDomainDef *def,
                                  virDomainDeviceDef *dev)
 {
-    GHashTable *aliases = NULL;
+    g_autoptr(GHashTable) aliases = NULL;
     virDomainDeviceInfo *info = virDomainDeviceGetInfo(dev);
-    int ret = -1;
 
     if (!info || !info->alias)
         return 0;
 
     if (virDomainDefValidateAliases(def, &aliases) < 0)
-        goto cleanup;
+        return -1;
 
     if (virHashLookup(aliases, info->alias)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("non unique alias detected: %s"),
                        info->alias);
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
- cleanup:
-
-    virHashFree(aliases);
-    return ret;
+    return 0;
 }