Make multifd_send_set_error() take ownership of the error always.  Paving
way for making migrate_set_error() to take ownership.

Signed-off-by: Peter Xu <[email protected]>
---
 migration/multifd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/migration/multifd.c b/migration/multifd.c
index 3203dc98e1..930eee9949 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -429,6 +429,7 @@ static void multifd_send_set_error(Error *err)
     if (err) {
         MigrationState *s = migrate_get_current();
         migrate_set_error(s, err);
+        error_free(err);
         if (s->state == MIGRATION_STATUS_SETUP ||
             s->state == MIGRATION_STATUS_PRE_SWITCHOVER ||
             s->state == MIGRATION_STATUS_DEVICE ||
@@ -779,7 +780,6 @@ out:
         trace_multifd_send_error(p->id);
         multifd_send_set_error(local_err);
         multifd_send_kick_main(p);
-        error_free(local_err);
     }
 
     rcu_unregister_thread();
@@ -908,7 +908,6 @@ out:
      * cleanup code doesn't even know its existence.
      */
     object_unref(OBJECT(ioc));
-    error_free(local_err);
 }
 
 static bool multifd_new_send_channel_create(gpointer opaque, Error **errp)
-- 
2.50.1


Reply via email to