From 5b4ae09e7158cbd2f10a8a55523ea781b5b75d7e Mon Sep 17 00:00:00 2001 From: Daniel Henrique Barboza Date: Mon, 13 Jul 2020 06:49:41 -0300 Subject: [PATCH] qemu_migration_params.c: modernize qemuMigrationParamsFetch() Use g_autoptr() and remove the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- 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; + return -1; - ret = 0; - - cleanup: - virJSONValueFree(jsonParams); - return ret; + return 0; }