1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemuDomainAssignMemorySlots: Refactor cleanup

Automatically free the 'slotmap' bitmap and get rid of the cleanup
section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-12-07 17:20:46 +01:00
parent 5cbdea694d
commit 0b18972630

View File

@ -3086,8 +3086,7 @@ qemuDomainReleaseMemoryDeviceSlot(virDomainObj *vm,
static int
qemuDomainAssignMemorySlots(virDomainDef *def)
{
virBitmap *slotmap = NULL;
int ret = -1;
g_autoptr(virBitmap) slotmap = NULL;
size_t i;
if (!virDomainDefHasMemoryHotplug(def))
@ -3103,7 +3102,7 @@ qemuDomainAssignMemorySlots(virDomainDef *def)
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
if (qemuAssignMemoryDeviceSlot(def->mems[i], slotmap) < 0)
goto cleanup;
return -1;
break;
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
@ -3116,12 +3115,7 @@ qemuDomainAssignMemorySlots(virDomainDef *def)
}
}
ret = 0;
cleanup:
virBitmapFree(slotmap);
return ret;
return 0;
}