Use g_autofree and remove the unneeded 'cleanup' label.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_driver.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8ea4197d00..6b47e28e99 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12346,14 +12346,13 @@ qemuDomainMigrateBegin3Params(virDomainPtr domain,
{
const char *xmlin = NULL;
const char *dname = NULL;
- const char **migrate_disks = NULL;
+ g_autofree const char **migrate_disks = NULL;
int nmigrate_disks;
- char *ret = NULL;
virDomainObjPtr vm;
virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);
if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS) < 0)
- goto cleanup;
+ return NULL;
if (virTypedParamsGetString(params, nparams,
VIR_MIGRATE_PARAM_DEST_XML,
@@ -12361,30 +12360,26 @@ qemuDomainMigrateBegin3Params(virDomainPtr domain,
virTypedParamsGetString(params, nparams,
VIR_MIGRATE_PARAM_DEST_NAME,
&dname) < 0)
- goto cleanup;
+ return NULL;
nmigrate_disks = virTypedParamsGetStringList(params, nparams,
VIR_MIGRATE_PARAM_MIGRATE_DISKS,
&migrate_disks);
if (nmigrate_disks < 0)
- goto cleanup;
+ return NULL;
if (!(vm = qemuDomainObjFromDomain(domain)))
- goto cleanup;
+ return NULL;
if (virDomainMigrateBegin3ParamsEnsureACL(domain->conn, vm->def) < 0) {
virDomainObjEndAPI(&vm);
- goto cleanup;
+ return NULL;
}
- ret = qemuMigrationSrcBegin(domain->conn, vm, xmlin, dname,
- cookieout, cookieoutlen,
- nmigrate_disks, migrate_disks, flags);
-
- cleanup:
- VIR_FREE(migrate_disks);
- return ret;
+ return qemuMigrationSrcBegin(domain->conn, vm, xmlin, dname,
+ cookieout, cookieoutlen,
+ nmigrate_disks, migrate_disks, flags);
}
--
2.26.2