[PATCH 03/10] qemuMigrationSrcBegin: Automatically free 'xml' variable on error

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

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 25af291dc6..6b3815ac58 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2487,7 +2487,7 @@ qemuMigrationSrcBegin(virConnectPtr conn,
 {
     virQEMUDriver *driver = conn->privateData;
     g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
-    char *xml = NULL;
+    g_autofree char *xml = NULL;
     virDomainAsyncJob asyncJob;

     if (cfg->migrateTLSForce &&
@@ -2532,10 +2532,8 @@ qemuMigrationSrcBegin(virConnectPtr conn,
          * place.
          */
         if (virCloseCallbacksSet(driver->closeCallbacks, vm, conn,
-                                 qemuMigrationSrcCleanup) < 0) {
-            VIR_FREE(xml);
+                                 qemuMigrationSrcCleanup) < 0)
             goto endjob;
-        }
         qemuMigrationJobContinue(vm);
     } else {
         goto endjob;
@@ -2543,7 +2541,7 @@ qemuMigrationSrcBegin(virConnectPtr conn,

  cleanup:
     virDomainObjEndAPI(&vm);
-    return xml;
+    return g_steal_pointer(&xml);

  endjob:
     if (flags & VIR_MIGRATE_CHANGE_PROTECTION)
-- 
2.35.3




[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