Use automatic memory freeing for the 'ret' bitmap and remove the
pointless 'cleanup' section.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 2e1d18c633..f307420ac1 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -6473,7 +6473,7 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDef *def,
unsigned int nvcpus,
bool *enable)
{
- virBitmap *ret = NULL;
+ g_autoptr(virBitmap) ret = NULL;
virDomainVcpuDef *vcpu;
qemuDomainVcpuPrivate *vcpupriv;
unsigned int maxvcpus = virDomainDefGetVcpusMax(def);
@@ -6501,7 +6501,7 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDef *def,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("target vm vcpu granularity does not allow the
"
"desired vcpu count"));
- goto error;
+ return NULL;
}
ignore_value(virBitmapSetBit(ret, i));
@@ -6528,7 +6528,7 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDef *def,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("target vm vcpu granularity does not allow the
"
"desired vcpu count"));
- goto error;
+ return NULL;
}
ignore_value(virBitmapSetBit(ret, i));
@@ -6539,14 +6539,10 @@ qemuDomainSelectHotplugVcpuEntities(virDomainDef *def,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("failed to find appropriate hotpluggable vcpus to "
"reach the desired target vcpu count"));
- goto error;
+ return NULL;
}
- return ret;
-
- error:
- virBitmapFree(ret);
- return NULL;
+ return g_steal_pointer(&ret);
}
--
2.31.1