[PATCH 5/5] hyperv: Simplify @memResource freeing in hypervDomainSetMemoryFlags()

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

 



Now, that ownership transfer of hypervSetEmbeddedProperty() is
clear, we can use automatic freeing of the hash table.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/hyperv/hyperv_driver.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index cae284db0b..9ec2b879fc 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -1735,7 +1735,7 @@ hypervDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
     Msvm_VirtualSystemSettingData *vssd = NULL;
     Msvm_MemorySettingData *memsd = NULL;
     g_auto(virBuffer) eprQuery = VIR_BUFFER_INITIALIZER;
-    virHashTablePtr memResource = NULL;
+    g_autoptr(virHashTable) memResource = NULL;
 
     virCheckFlags(0, -1);
 
@@ -1781,21 +1781,17 @@ hypervDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
     if (!memResource)
         goto cleanup;
 
-    if (hypervSetEmbeddedProperty(memResource, "VirtualQuantity", memory_str) < 0) {
-        hypervFreeEmbeddedParam(memResource);
+    if (hypervSetEmbeddedProperty(memResource, "VirtualQuantity", memory_str) < 0)
         goto cleanup;
-    }
 
     if (hypervSetEmbeddedProperty(memResource, "InstanceID",
                 memsd->data.common->InstanceID) < 0) {
-        hypervFreeEmbeddedParam(memResource);
         goto cleanup;
     }
 
     if (priv->wmiVersion == HYPERV_WMI_VERSION_V1) {
         if (hypervAddEmbeddedParam(params, priv, "ResourceSettingData",
                                    &memResource, Msvm_MemorySettingData_WmiInfo) < 0) {
-            hypervFreeEmbeddedParam(memResource);
             goto cleanup;
         }
 
-- 
2.26.2




[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