qemu_migration.c: modernize qemuMigrationDstPersist()

Use g_autoptr() 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:53 -03:00 committed by Michal Privoznik
parent ab6e89a81d
commit 494a2acd09

View File

@ -4926,13 +4926,12 @@ qemuMigrationDstPersist(virQEMUDriverPtr driver,
qemuMigrationCookiePtr mig,
bool ignoreSaveError)
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData;
virDomainDefPtr vmdef;
virDomainDefPtr oldDef = NULL;
g_autoptr(virDomainDef) oldDef = NULL;
unsigned int oldPersist = vm->persistent;
virObjectEventPtr event;
int ret = -1;
vm->persistent = 1;
oldDef = vm->newDef;
@ -4953,19 +4952,14 @@ qemuMigrationDstPersist(virQEMUDriverPtr driver,
VIR_DOMAIN_EVENT_DEFINED_ADDED);
virObjectEventStateQueue(driver->domainEventState, event);
ret = 0;
cleanup:
virDomainDefFree(oldDef);
virObjectUnref(cfg);
return ret;
return 0;
error:
virDomainDefFree(vm->newDef);
vm->persistent = oldPersist;
vm->newDef = oldDef;
oldDef = NULL;
goto cleanup;
return -1;
}