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

qemu_migration.c: use g_auto* in qemuMigrationDstPrepareAny()

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:40 -03:00 committed by Michal Privoznik
parent 1a86aee92a
commit db64224bca

View File

@ -2389,7 +2389,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = NULL; qemuDomainObjPrivatePtr priv = NULL;
qemuMigrationCookiePtr mig = NULL; qemuMigrationCookiePtr mig = NULL;
bool tunnel = !!st; bool tunnel = !!st;
char *xmlout = NULL; g_autofree char *xmlout = NULL;
unsigned int cookieFlags; unsigned int cookieFlags;
unsigned int startFlags; unsigned int startFlags;
qemuProcessIncomingDefPtr incoming = NULL; qemuProcessIncomingDefPtr incoming = NULL;
@ -2397,7 +2397,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
bool stopProcess = false; bool stopProcess = false;
bool relabel = false; bool relabel = false;
int rv; int rv;
char *tlsAlias = NULL; g_autofree char *tlsAlias = NULL;
virNWFilterReadLockFilterUpdates(); virNWFilterReadLockFilterUpdates();
@ -2447,7 +2447,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
/* Let migration hook filter domain XML */ /* Let migration hook filter domain XML */
if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) { if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) {
char *xml; g_autofree char *xml = NULL;
int hookret; int hookret;
if (!(xml = qemuDomainDefFormatXML(driver, NULL, *def, if (!(xml = qemuDomainDefFormatXML(driver, NULL, *def,
@ -2458,7 +2458,6 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, (*def)->name, hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, (*def)->name,
VIR_HOOK_QEMU_OP_MIGRATE, VIR_HOOK_SUBOP_BEGIN, VIR_HOOK_QEMU_OP_MIGRATE, VIR_HOOK_SUBOP_BEGIN,
NULL, xml, &xmlout); NULL, xml, &xmlout);
VIR_FREE(xml);
if (hookret < 0) { if (hookret < 0) {
goto cleanup; goto cleanup;
@ -2467,7 +2466,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
VIR_DEBUG("Migrate hook filter returned nothing; using the" VIR_DEBUG("Migrate hook filter returned nothing; using the"
" original XML"); " original XML");
} else { } else {
virDomainDefPtr newdef; g_autoptr(virDomainDef) newdef = NULL;
VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout); VIR_DEBUG("Using hook-filtered domain XML: %s", xmlout);
newdef = virDomainDefParseString(xmlout, driver->xmlopt, NULL, newdef = virDomainDefParseString(xmlout, driver->xmlopt, NULL,
@ -2476,13 +2475,11 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
if (!newdef) if (!newdef)
goto cleanup; goto cleanup;
if (!qemuDomainDefCheckABIStability(driver, NULL, *def, newdef)) { if (!qemuDomainDefCheckABIStability(driver, NULL, *def, newdef))
virDomainDefFree(newdef);
goto cleanup; goto cleanup;
}
virDomainDefFree(*def); virDomainDefFree(*def);
*def = newdef; *def = g_steal_pointer(&newdef);
/* We should taint the domain here. However, @vm and therefore /* We should taint the domain here. However, @vm and therefore
* privateData too are still NULL, so just notice the fact and * privateData too are still NULL, so just notice the fact and
* taint it later. */ * taint it later. */
@ -2694,9 +2691,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
cleanup: cleanup:
virErrorPreserveLast(&origErr); virErrorPreserveLast(&origErr);
VIR_FREE(tlsAlias);
qemuProcessIncomingDefFree(incoming); qemuProcessIncomingDefFree(incoming);
VIR_FREE(xmlout);
VIR_FORCE_CLOSE(dataFD[0]); VIR_FORCE_CLOSE(dataFD[0]);
VIR_FORCE_CLOSE(dataFD[1]); VIR_FORCE_CLOSE(dataFD[1]);
if (ret < 0 && priv) { if (ret < 0 && priv) {