mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
hyperv: use g_autoptr for WMI classes in hypervDomainGetMaxMemory
Signed-off-by: Matt Coleman <matt@datto.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
85fbc6c85d
commit
25faf51e01
@ -1860,25 +1860,18 @@ hypervDomainGetMaxMemory(virDomainPtr domain)
|
||||
{
|
||||
char uuid_string[VIR_UUID_STRING_BUFLEN];
|
||||
hypervPrivate *priv = domain->conn->privateData;
|
||||
Msvm_VirtualSystemSettingData *vssd = NULL;
|
||||
Msvm_MemorySettingData *mem_sd = NULL;
|
||||
int maxMemoryBytes = 0;
|
||||
g_autoptr(Msvm_VirtualSystemSettingData) vssd = NULL;
|
||||
g_autoptr(Msvm_MemorySettingData) mem_sd = NULL;
|
||||
|
||||
virUUIDFormat(domain->uuid, uuid_string);
|
||||
|
||||
if (hypervGetMsvmVirtualSystemSettingDataFromUUID(priv, uuid_string, &vssd) < 0)
|
||||
goto cleanup;
|
||||
return 0;
|
||||
|
||||
if (hypervGetMemorySD(priv, vssd->data->InstanceID, &mem_sd) < 0)
|
||||
goto cleanup;
|
||||
return 0;
|
||||
|
||||
maxMemoryBytes = mem_sd->data->Limit * 1024;
|
||||
|
||||
cleanup:
|
||||
hypervFreeObject((hypervObject *)vssd);
|
||||
hypervFreeObject((hypervObject *)mem_sd);
|
||||
|
||||
return maxMemoryBytes;
|
||||
return mem_sd->data->Limit * 1024;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user