qemu_migration.c: modernize qemuMigrationDstPrepare()

Use g_autofree and remove the 'cleanup' label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Daniel Henrique Barboza 2020-07-13 06:49:39 -03:00 committed by Michal Privoznik
parent e200803f45
commit 1a86aee92a

View File

@ -2306,8 +2306,7 @@ qemuMigrationDstPrepare(virDomainObjPtr vm,
int fd) int fd)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
qemuProcessIncomingDefPtr inc = NULL; g_autofree char *migrateFrom = NULL;
char *migrateFrom = NULL;
if (tunnel) { if (tunnel) {
migrateFrom = g_strdup("stdio"); migrateFrom = g_strdup("stdio");
@ -2329,7 +2328,7 @@ qemuMigrationDstPrepare(virDomainObjPtr vm,
if (!hostIPv6Capable) { if (!hostIPv6Capable) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("host isn't capable of IPv6")); _("host isn't capable of IPv6"));
goto cleanup; return NULL;
} }
/* IPv6 address must be escaped in brackets on the cmd line */ /* IPv6 address must be escaped in brackets on the cmd line */
encloseAddress = true; encloseAddress = true;
@ -2358,12 +2357,8 @@ qemuMigrationDstPrepare(virDomainObjPtr vm,
migrateFrom = g_strdup_printf(incFormat, protocol, listenAddress, port); migrateFrom = g_strdup_printf(incFormat, protocol, listenAddress, port);
} }
inc = qemuProcessIncomingDefNew(priv->qemuCaps, listenAddress, return qemuProcessIncomingDefNew(priv->qemuCaps, listenAddress,
migrateFrom, fd, NULL); migrateFrom, fd, NULL);
cleanup:
VIR_FREE(migrateFrom);
return inc;
} }
static int static int