[libvirt PATCH 62/80] qemu: Simplify cleanup in qemuMigrationDstPrepareFresh

Jiri Denemark jdenemar at redhat.com
Tue May 10 15:21:23 UTC 2022


Since most of the cleanup code was moved out of this function, we don't
need to preserve the original error here.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/qemu/qemu_migration.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index dc608fb8a4..07b8c99343 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3334,10 +3334,9 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver,
                              unsigned long flags)
 {
     virDomainObj *vm = NULL;
-    virErrorPtr origErr;
     int ret = -1;
     qemuDomainObjPrivate *priv = NULL;
-    qemuMigrationCookie *mig = NULL;
+    g_autoptr(qemuMigrationCookie) mig = NULL;
     g_autofree char *xmlout = NULL;
     unsigned int cookieFlags = 0;
     bool taint_hook = false;
@@ -3480,7 +3479,6 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver,
     ret = 0;
 
  cleanup:
-    virErrorPreserveLast(&origErr);
     if (ret < 0 && priv) {
         /* priv is set right after vm is added to the list of domains
          * and there is no 'goto cleanup;' in the middle of those */
@@ -3489,8 +3487,6 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver,
         qemuDomainRemoveInactive(driver, vm);
     }
     virDomainObjEndAPI(&vm);
-    qemuMigrationCookieFree(mig);
-    virErrorRestore(&origErr);
     return ret;
 
  stopjob:
-- 
2.35.1



More information about the libvir-list mailing list