From 83174765da3563794a56fbe24216908f3a5db194 Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Thu, 31 Mar 2022 11:08:39 -0400 Subject: [PATCH] migration: Postpone releasing MigrationState.hostname MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We used to release it right after migrate_fd_connect(). That's not good enough when there're more than one socket pair required, because it'll be needed to establish TLS connection for the rest channels. One example is multifd, where we copied over the hostname for each channel but that's actually not needed. Keeping the hostname until the cleanup phase of migration. Cc: Daniel P. Berrange Signed-off-by: Peter Xu Message-Id: <20220331150857.74406-2-peterx@redhat.com> Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Daniel P. Berrangé Signed-off-by: Dr. David Alan Gilbert dgilbert: Fixup checkpatch error; don't need to check for NULL around g_free --- migration/channel.c | 1 - migration/migration.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/channel.c b/migration/channel.c index c4fc000a1a..c6a8dcf1d7 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -96,6 +96,5 @@ void migration_channel_connect(MigrationState *s, } } migrate_fd_connect(s, error); - g_free(s->hostname); error_free(error); } diff --git a/migration/migration.c b/migration/migration.c index 4dcb511bb6..3f61a08752 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1809,6 +1809,9 @@ static void migrate_fd_cleanup(MigrationState *s) qemu_bh_delete(s->cleanup_bh); s->cleanup_bh = NULL; + g_free(s->hostname); + s->hostname = NULL; + qemu_savevm_state_cleanup(); if (s->to_dst_file) {