From: Juan Quintela Date: Wed, 3 Nov 2021 19:24:27 +0000 (+0100) Subject: migration: Check that postcopy fd's are not NULL X-Git-Tag: v6.2.0-rc0~9^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=565599807fee415a2e071d2c4f532f4e3bb18dcb;p=thirdparty%2Fqemu.git migration: Check that postcopy fd's are not NULL If postcopy has finished, it frees the array. But vhost-user unregister it at cleanup time. fixes: c4f7538 Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index e721f69d0f8..d18b5d05b2f 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -1457,6 +1457,10 @@ void postcopy_unregister_shared_ufd(struct PostCopyFD *pcfd) MigrationIncomingState *mis = migration_incoming_get_current(); GArray *pcrfds = mis->postcopy_remote_fds; + if (!pcrfds) { + /* migration has already finished and freed the array */ + return; + } for (i = 0; i < pcrfds->len; i++) { struct PostCopyFD *cur = &g_array_index(pcrfds, struct PostCopyFD, i); if (cur->fd == pcfd->fd) {