[PATCH 3/7] qemuMigrationParamsFromJSON: Unify return value handling with other functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_migration_params.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 03d8d4fb49..3ed55c2ab4 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -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);
 }


-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux