From 2ce05af9f207c8a7c18290a57533e17fa244e696 Mon Sep 17 00:00:00 2001 From: Matt Coleman Date: Thu, 21 Jan 2021 13:50:54 -0500 Subject: [PATCH] hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainLookupByID Signed-off-by: Matt Coleman Reviewed-by: Laine Stump --- src/hyperv/hyperv_driver.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 45463d120d..e5a62c728b 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -1654,16 +1654,13 @@ hypervDomainLookupByID(virConnectPtr conn, int id) { virDomainPtr domain = NULL; hypervPrivate *priv = conn->privateData; - Msvm_ComputerSystem *computerSystem = NULL; + g_autoptr(Msvm_ComputerSystem) computerSystem = NULL; if (hypervGetVirtualSystemByID(priv, id, &computerSystem) < 0) - goto cleanup; + return NULL; hypervMsvmComputerSystemToDomain(conn, computerSystem, &domain); - cleanup: - hypervFreeObject((hypervObject *)computerSystem); - return domain; }