From: Matt Coleman Date: Thu, 21 Jan 2021 18:50:57 +0000 (-0500) Subject: hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainResume X-Git-Tag: v7.1.0-rc1~484 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ca4c0f7f90fe7bc7124fa90009c746d34be3333;p=thirdparty%2Flibvirt.git hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainResume Signed-off-by: Matt Coleman Reviewed-by: Laine Stump --- diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index dd5c42c45b..1eb3dbd48e 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -1717,8 +1717,7 @@ hypervDomainSuspend(virDomainPtr domain) static int hypervDomainResume(virDomainPtr domain) { - int result = -1; - Msvm_ComputerSystem *computerSystem = NULL; + g_autoptr(Msvm_ComputerSystem) computerSystem = NULL; if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) return -1; @@ -1726,16 +1725,11 @@ hypervDomainResume(virDomainPtr domain) if (computerSystem->data->EnabledState != MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_QUIESCE) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not paused")); - goto cleanup; + return -1; } - result = hypervInvokeMsvmComputerSystemRequestStateChange(domain, - MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_ENABLED); - - cleanup: - hypervFreeObject((hypervObject *)computerSystem); - - return result; + return hypervInvokeMsvmComputerSystemRequestStateChange(domain, + MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_ENABLED); }