]> xenbits.xensource.com Git - qemu-xen-unstable.git/commitdiff
virtio-iommu: avoid memleak in the unrealize
authorPan Nengyuan <pannengyuan@huawei.com>
Sat, 28 Mar 2020 00:57:05 +0000 (08:57 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 29 Mar 2020 13:52:13 +0000 (09:52 -0400)
req_vq/event_vq forgot to free in unrealize. Fix that.
And also do clean 's->as_by_busptr' hash table in unrealize to fix another leak.

Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Acked-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20200328005705.29898-3-pannengyuan@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio-iommu.c

index 4cee8083bc56a435232cf21db77141eefce0adf6..22ba8848c2fe6bad74a1379dfc911db759ed1292 100644 (file)
@@ -693,9 +693,12 @@ static void virtio_iommu_device_unrealize(DeviceState *dev, Error **errp)
     VirtIODevice *vdev = VIRTIO_DEVICE(dev);
     VirtIOIOMMU *s = VIRTIO_IOMMU(dev);
 
+    g_hash_table_destroy(s->as_by_busptr);
     g_tree_destroy(s->domains);
     g_tree_destroy(s->endpoints);
 
+    virtio_delete_queue(s->req_vq);
+    virtio_delete_queue(s->event_vq);
     virtio_cleanup(vdev);
 }