mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
hyperv: Simplify @memResource freeing in hypervDomainSetMemoryFlags()
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>
This commit is contained in:
parent
e0a09c243c
commit
07cec18a51
@ -1735,7 +1735,7 @@ hypervDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
|
|||||||
Msvm_VirtualSystemSettingData *vssd = NULL;
|
Msvm_VirtualSystemSettingData *vssd = NULL;
|
||||||
Msvm_MemorySettingData *memsd = NULL;
|
Msvm_MemorySettingData *memsd = NULL;
|
||||||
g_auto(virBuffer) eprQuery = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) eprQuery = VIR_BUFFER_INITIALIZER;
|
||||||
virHashTablePtr memResource = NULL;
|
g_autoptr(virHashTable) memResource = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
@ -1781,21 +1781,17 @@ hypervDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
|
|||||||
if (!memResource)
|
if (!memResource)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (hypervSetEmbeddedProperty(memResource, "VirtualQuantity", memory_str) < 0) {
|
if (hypervSetEmbeddedProperty(memResource, "VirtualQuantity", memory_str) < 0)
|
||||||
hypervFreeEmbeddedParam(memResource);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (hypervSetEmbeddedProperty(memResource, "InstanceID",
|
if (hypervSetEmbeddedProperty(memResource, "InstanceID",
|
||||||
memsd->data.common->InstanceID) < 0) {
|
memsd->data.common->InstanceID) < 0) {
|
||||||
hypervFreeEmbeddedParam(memResource);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->wmiVersion == HYPERV_WMI_VERSION_V1) {
|
if (priv->wmiVersion == HYPERV_WMI_VERSION_V1) {
|
||||||
if (hypervAddEmbeddedParam(params, priv, "ResourceSettingData",
|
if (hypervAddEmbeddedParam(params, priv, "ResourceSettingData",
|
||||||
&memResource, Msvm_MemorySettingData_WmiInfo) < 0) {
|
&memResource, Msvm_MemorySettingData_WmiInfo) < 0) {
|
||||||
hypervFreeEmbeddedParam(memResource);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user