aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2021-11-03 20:24:27 +0100
committerJuan Quintela <quintela@redhat.com>2021-11-06 12:35:29 +0100
commit565599807fee415a2e071d2c4f532f4e3bb18dcb (patch)
tree30da3291f59c02c20c3eaa1cf708a7ca42bfc326 /migration
parentc39deb218178d1fb814dd2138ceff4b541a03d85 (diff)
downloadqemu-565599807fee415a2e071d2c4f532f4e3bb18dcb.zip
qemu-565599807fee415a2e071d2c4f532f4e3bb18dcb.tar.gz
qemu-565599807fee415a2e071d2c4f532f4e3bb18dcb.tar.bz2
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 <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/postcopy-ram.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index e721f69..d18b5d0 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) {