]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMigrationParamsFromJSON: Unify return value handling with other functions
authorPeter Krempa <pkrempa@redhat.com>
Wed, 19 Aug 2020 11:17:06 +0000 (13:17 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 24 Aug 2020 14:34:51 +0000 (16:34 +0200)
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>
src/qemu/qemu_migration_params.c

index 03d8d4fb49d47355e7d419c5ac2c30dd850da4e4..3ed55c2ab45a72d5e7b7b72d5967f008c9213ed7 100644 (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);
 }