[PATCH 46/55] hyperv: use g_autoptr for Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor in hypervDomainGetVcpus

Matt Coleman mcoleman at datto.com
Thu Jan 21 18:51:26 UTC 2021


Signed-off-by: Matt Coleman <matt at datto.com>
---
 src/hyperv/hyperv_driver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 4bf91cfa1a..84ffb24f1a 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -2071,7 +2071,7 @@ hypervDomainGetVcpus(virDomainPtr domain,
     int count = 0;
     int vcpu_number;
     hypervPrivate *priv = domain->conn->privateData;
-    Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor *vproc = NULL;
+    g_autoptr(Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor) vproc = NULL;
 
     /* Hyper-V does not allow setting CPU affinity: all cores will be used */
     if (cpumaps && maplen > 0)
@@ -2110,8 +2110,6 @@ hypervDomainGetVcpus(virDomainPtr domain,
         count++;
     }
 
-    hypervFreeObject((hypervObject *)vproc);
-
     return count;
 }
 
-- 
2.30.0





More information about the libvir-list mailing list