]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
hyperv: Simplify @memResource freeing in hypervDomainSetMemoryFlags()
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 15 Oct 2020 13:34:02 +0000 (15:34 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 19 Oct 2020 09:13:10 +0000 (11:13 +0200)
Now, that ownership transfer of hypervSetEmbeddedProperty() is
clear, we can use automatic freeing of the hash table.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
src/hyperv/hyperv_driver.c

index cae284db0b3fe54e381a1b14aa05ad17eeebf877..9ec2b879fcbccbb720c6925da4fe4fb71daf17f8 100644 (file)
@@ -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;
         }