From: Matt Coleman Date: Thu, 21 Jan 2021 18:51:08 +0000 (-0500) Subject: hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainGetState X-Git-Tag: v7.1.0-rc1~473 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf965ede11c9e09b5fca00f3479d75c4b2232cfd;p=thirdparty%2Flibvirt.git hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainGetState Signed-off-by: Matt Coleman Reviewed-by: Laine Stump --- diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 9cf074b6a7..44be9fbd2f 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -1957,25 +1957,19 @@ static int hypervDomainGetState(virDomainPtr domain, int *state, int *reason, 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; + return -1; *state = hypervMsvmComputerSystemEnabledStateToDomainState(computerSystem); if (reason != NULL) *reason = 0; - result = 0; - - cleanup: - hypervFreeObject((hypervObject *)computerSystem); - - return result; + return 0; }