Use g_autoptr() and remove the 'cleanup' label.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_migration_params.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 6953badcfe..6273acd65a 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -1092,28 +1092,23 @@ qemuMigrationParamsFetch(virQEMUDriverPtr driver,
qemuMigrationParamsPtr *migParams)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- virJSONValuePtr jsonParams = NULL;
- int ret = -1;
+ g_autoptr(virJSONValue) jsonParams = NULL;
int rc;
*migParams = NULL;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
- goto cleanup;
+ return -1;
rc = qemuMonitorGetMigrationParams(priv->mon, &jsonParams);
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
- goto cleanup;
+ return -1;
if (!(*migParams = qemuMigrationParamsFromJSON(jsonParams)))
- goto cleanup;
-
- ret = 0;
+ return -1;
- cleanup:
- virJSONValueFree(jsonParams);
- return ret;
+ return 0;
}
--
2.26.2