1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-12 13:17:58 +03:00

hyperv: use g_autoptr for Win32_OperatingSystem in hypervNodeGetFreeMemory

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:27 -05:00 committed by Laine Stump
parent 00beda0ee2
commit 59daea438e

View File

@ -2701,9 +2701,8 @@ hypervDomainGetSchedulerParameters(virDomainPtr domain,
static unsigned long long
hypervNodeGetFreeMemory(virConnectPtr conn)
{
unsigned long long freeMemoryBytes = 0;
hypervPrivate *priv = conn->privateData;
Win32_OperatingSystem *operatingSystem = NULL;
g_autoptr(Win32_OperatingSystem) operatingSystem = NULL;
if (hypervGetOperatingSystem(priv, &operatingSystem) < 0)
return 0;
@ -2715,11 +2714,7 @@ hypervNodeGetFreeMemory(virConnectPtr conn)
return 0;
}
freeMemoryBytes = operatingSystem->data->FreePhysicalMemory * 1024;
hypervFreeObject((hypervObject *)operatingSystem);
return freeMemoryBytes;
return operatingSystem->data->FreePhysicalMemory * 1024;
}