1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-26 03:21:44 +03:00

hyperv: use g_autoptr for Msvm_ComputerSystem in hypervDomainManagedSaveRemove

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
Matt Coleman 2021-01-21 13:51:20 -05:00 committed by Laine Stump
parent 54d96d7fde
commit 97c558b5d7

View File

@ -2843,27 +2843,21 @@ hypervDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags)
static int
hypervDomainManagedSaveRemove(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 (computerSystem->data->EnabledState != MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Domain has no managed save image"));
goto cleanup;
return -1;
}
result = hypervInvokeMsvmComputerSystemRequestStateChange(domain,
return hypervInvokeMsvmComputerSystemRequestStateChange(domain,
MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_DISABLED);
cleanup:
hypervFreeObject((hypervObject *)computerSystem);
return result;
}