summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/virtio/vhost.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 0049a2c0b3..5fd69f0b2e 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1356,6 +1356,10 @@ void vhost_dev_cleanup(struct vhost_dev *hdev)
if (hdev->mem) {
/* those are only safe after successful init */
memory_listener_unregister(&hdev->memory_listener);
+ for (i = 0; i < hdev->n_mem_sections; ++i) {
+ MemoryRegionSection *section = &hdev->mem_sections[i];
+ memory_region_unref(section->mr);
+ }
QLIST_REMOVE(hdev, entry);
}
if (hdev->migration_blocker) {