From: Matt Coleman Date: Thu, 21 Jan 2021 18:51:19 +0000 (-0500) Subject: hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainHasManagedSaveImage X-Git-Tag: v7.1.0-rc1~462 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54d96d7fde3a922d36c8c2e090adf0aa02aec6a9;p=thirdparty%2Flibvirt.git hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainHasManagedSaveImage Signed-off-by: Matt Coleman Reviewed-by: Laine Stump --- diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 476c24533d..d4852d55af 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -2829,20 +2829,14 @@ hypervDomainManagedSave(virDomainPtr domain, unsigned int flags) static int hypervDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags) { - int result = -1; - Msvm_ComputerSystem *computerSystem = NULL; + g_autoptr(Msvm_ComputerSystem) computerSystem = NULL; virCheckFlags(0, -1); if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) - goto cleanup; - - result = computerSystem->data->EnabledState == MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED ? 1 : 0; - - cleanup: - hypervFreeObject((hypervObject *)computerSystem); + return -1; - return result; + return computerSystem->data->EnabledState == MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED ? 1 : 0; }