mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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:
parent
00beda0ee2
commit
59daea438e
@ -2701,9 +2701,8 @@ hypervDomainGetSchedulerParameters(virDomainPtr domain,
|
|||||||
static unsigned long long
|
static unsigned long long
|
||||||
hypervNodeGetFreeMemory(virConnectPtr conn)
|
hypervNodeGetFreeMemory(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
unsigned long long freeMemoryBytes = 0;
|
|
||||||
hypervPrivate *priv = conn->privateData;
|
hypervPrivate *priv = conn->privateData;
|
||||||
Win32_OperatingSystem *operatingSystem = NULL;
|
g_autoptr(Win32_OperatingSystem) operatingSystem = NULL;
|
||||||
|
|
||||||
if (hypervGetOperatingSystem(priv, &operatingSystem) < 0)
|
if (hypervGetOperatingSystem(priv, &operatingSystem) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
@ -2715,11 +2714,7 @@ hypervNodeGetFreeMemory(virConnectPtr conn)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
freeMemoryBytes = operatingSystem->data->FreePhysicalMemory * 1024;
|
return operatingSystem->data->FreePhysicalMemory * 1024;
|
||||||
|
|
||||||
hypervFreeObject((hypervObject *)operatingSystem);
|
|
||||||
|
|
||||||
return freeMemoryBytes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user