Signed-off-by: Matt Coleman <matt(a)datto.com>
---
src/hyperv/hyperv_driver.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index f3fe88926e..ef3ae54f7d 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -197,23 +197,17 @@ hypervGetOperatingSystem(hypervPrivate *priv, Win32_OperatingSystem
**operatingS
static int
hypervRequestStateChange(virDomainPtr domain, int state)
{
- int result = -1;
- Msvm_ComputerSystem *computerSystem = NULL;
+ g_autoptr(Msvm_ComputerSystem) computerSystem = NULL;
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
- goto cleanup;
+ return -1;
if (computerSystem->data->EnabledState !=
MSVM_COMPUTERSYSTEM_ENABLEDSTATE_ENABLED) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not
active"));
- goto cleanup;
+ return -1;
}
- result = hypervInvokeMsvmComputerSystemRequestStateChange(domain, state);
-
- cleanup:
- hypervFreeObject((hypervObject *)computerSystem);
-
- return result;
+ return hypervInvokeMsvmComputerSystemRequestStateChange(domain, state);
}
--
2.30.0