hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainIsActive

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
Matt Coleman 2021-01-21 13:51:17 -05:00 committed by Laine Stump
parent 5997e1e218
commit acb9273074
1 changed files with 3 additions and 9 deletions
src/hyperv

View File

@ -2770,18 +2770,12 @@ hypervConnectIsAlive(virConnectPtr conn)
static int
hypervDomainIsActive(virDomainPtr domain)
{
int result = -1;
Msvm_ComputerSystem *computerSystem = NULL;
g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
goto cleanup;
return -1;
result = hypervIsMsvmComputerSystemActive(computerSystem, NULL) ? 1 : 0;
cleanup:
hypervFreeObject((hypervObject *)computerSystem);
return result;
return hypervIsMsvmComputerSystemActive(computerSystem, NULL) ? 1 : 0;
}