qemuMigrationParamsFromJSON: Unify return value handling with other functions

This function doesn't have an overly verbose cleanup section as there
isn't any error code path. Unify it with the rest of the functions which
will simplify adding a possible error path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-08-19 13:17:06 +02:00
parent a8d0ab02f6
commit f2108c790c

View File

@ -670,7 +670,7 @@ qemuMigrationParamsDump(qemuMigrationParamsPtr migParams,
qemuMigrationParamsPtr
qemuMigrationParamsFromJSON(virJSONValuePtr params)
{
qemuMigrationParamsPtr migParams;
g_autoptr(qemuMigrationParams) migParams = NULL;
qemuMigrationParamValuePtr pv;
const char *name;
const char *str;
@ -680,7 +680,7 @@ qemuMigrationParamsFromJSON(virJSONValuePtr params)
return NULL;
if (!params)
return migParams;
return g_steal_pointer(&migParams);
for (i = 0; i < QEMU_MIGRATION_PARAM_LAST; i++) {
name = qemuMigrationParamTypeToString(i);
@ -711,7 +711,7 @@ qemuMigrationParamsFromJSON(virJSONValuePtr params)
}
}
return migParams;
return g_steal_pointer(&migParams);
}