From 35ebb28f3f1ace7e85138aa29480a1dc934fca41 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 30 Nov 2021 11:33:52 +0100 Subject: [PATCH] virDomainDeviceValidateAliasImpl: Automatically free GHashTable and remove cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit After the conversion to g_autofree, the cleanup label is no longer needed. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko Reviewed-by: Martin Kletzander --- src/conf/domain_validate.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 80401cf8c7..a4271f1247 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -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; } -- 2.47.2