Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- hw/i386/kvm/pci-assign.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index 4b1c2d9..6eb4c96 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -1837,6 +1837,13 @@ static void assigned_exitfn(struct PCIDevice *pci_dev) AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev); deassign_device(dev); +} + +static void assigned_instance_finalize(Object *obj) +{ + PCIDevice *pci_dev = PCI_DEVICE(obj); + AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev); + free_assigned_device(dev); } @@ -1871,6 +1878,7 @@ static const TypeInfo assign_info = { .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(AssignedDevice), .class_init = assign_class_init, + .instance_finalize = assigned_instance_finalize, }; static void assign_register_types(void) -- 1.8.1.4