From: Matt Coleman Date: Thu, 21 Jan 2021 18:50:56 +0000 (-0500) Subject: hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByName X-Git-Tag: v7.1.0-rc1~485 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ebca8a6b72219633533d198befdd78842bb0e4e3;p=thirdparty%2Flibvirt.git hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByName Signed-off-by: Matt Coleman Reviewed-by: Laine Stump --- diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index fe1ab1c52c..dd5c42c45b 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -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; }