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 a73b463260..535bd34733 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -2311,27 +2311,21 @@ hypervConnectNumOfDefinedDomains(virConnectPtr conn)
static int
hypervDomainCreateWithFlags(virDomainPtr domain, 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;
if (hypervIsMsvmComputerSystemActive(computerSystem, NULL)) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Domain is already active or is in state
transition"));
- goto cleanup;
+ return -1;
}
- result = hypervInvokeMsvmComputerSystemRequestStateChange(domain,
-
MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_ENABLED);
-
- cleanup:
- hypervFreeObject((hypervObject *)computerSystem);
-
- return result;
+ return hypervInvokeMsvmComputerSystemRequestStateChange(domain,
+
MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_ENABLED);
}
--
2.30.0