mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 09:55:18 +00:00
hyperv: use g_autoptr for Msvm_ComputerSystem in hypervRequestStateChange
Signed-off-by: Matt Coleman <matt@datto.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
f7c167a76e
commit
08df82a72e
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user