From 1a86aee92a5243f1ba1bd40f56ef84f73a3ddd2d Mon Sep 17 00:00:00 2001 From: Daniel Henrique Barboza Date: Mon, 13 Jul 2020 06:49:39 -0300 Subject: [PATCH] qemu_migration.c: modernize qemuMigrationDstPrepare() Use g_autofree and remove the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 4ef3245c75..e0077d731b 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2306,8 +2306,7 @@ qemuMigrationDstPrepare(virDomainObjPtr vm, int fd) { qemuDomainObjPrivatePtr priv = vm->privateData; - qemuProcessIncomingDefPtr inc = NULL; - char *migrateFrom = NULL; + g_autofree char *migrateFrom = NULL; if (tunnel) { migrateFrom = g_strdup("stdio"); @@ -2329,7 +2328,7 @@ qemuMigrationDstPrepare(virDomainObjPtr vm, if (!hostIPv6Capable) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("host isn't capable of IPv6")); - goto cleanup; + return NULL; } /* IPv6 address must be escaped in brackets on the cmd line */ encloseAddress = true; @@ -2358,12 +2357,8 @@ qemuMigrationDstPrepare(virDomainObjPtr vm, migrateFrom = g_strdup_printf(incFormat, protocol, listenAddress, port); } - inc = qemuProcessIncomingDefNew(priv->qemuCaps, listenAddress, - migrateFrom, fd, NULL); - - cleanup: - VIR_FREE(migrateFrom); - return inc; + return qemuProcessIncomingDefNew(priv->qemuCaps, listenAddress, + migrateFrom, fd, NULL); } static int