diff options
-rw-r--r-- | hw/vfio/pci.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 68dd992836..c89fdf7ae6 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -1752,9 +1752,11 @@ static void vfio_bars_finalize(VFIOPCIDevice *vdev) vfio_bar_quirk_finalize(vdev, i); vfio_region_finalize(&bar->region); - if (bar->size) { + if (bar->mr) { + assert(bar->size); object_unparent(OBJECT(bar->mr)); g_free(bar->mr); + bar->mr = NULL; } } |