Signed-off-by: Matt Coleman <matt(a)datto.com>
---
src/hyperv/hyperv_driver.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index fcb764c0f7..7da4c216b1 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -1818,29 +1818,23 @@ hypervDomainReset(virDomainPtr domain, unsigned int flags)
static int
hypervDomainDestroyFlags(virDomainPtr domain, unsigned int flags)
{
- int result = -1;
- Msvm_ComputerSystem *computerSystem = NULL;
+ g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
bool in_transition = false;
virCheckFlags(0, -1);
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
- goto cleanup;
+ return -1;
if (!hypervIsMsvmComputerSystemActive(computerSystem, &in_transition) ||
in_transition) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Domain is not active or is in state transition"));
- goto cleanup;
+ return -1;
}
- result = hypervInvokeMsvmComputerSystemRequestStateChange(domain,
-
MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_DISABLED);
-
- cleanup:
- hypervFreeObject((hypervObject *)computerSystem);
-
- return result;
+ return hypervInvokeMsvmComputerSystemRequestStateChange(domain,
+
MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_DISABLED);
}
--
2.30.0