[PATCH 47/55] hyperv: use g_autoptr for Win32_OperatingSystem in hypervNodeGetFreeMemory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Matt Coleman <matt@xxxxxxxxx>
---
 src/hyperv/hyperv_driver.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 84ffb24f1a..bd3c5a7c34 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -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;
 }
 
 
-- 
2.30.0





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux