Signed-off-by: Matt Coleman <m...@datto.com> --- src/hyperv/hyperv_driver.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 6fa32d175d..e501a88889 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -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; - - result = hypervIsMsvmComputerSystemActive(computerSystem, NULL) ? 1 : 0; - - cleanup: - hypervFreeObject((hypervObject *)computerSystem); + return -1; - return result; + return hypervIsMsvmComputerSystemActive(computerSystem, NULL) ? 1 : 0; } -- 2.30.0