mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
virtio-iommu: Check gtrees are non null before destroying them
If realize fails, domains and endpoints trees may be NULL. On unrealize(), this produces assertions: "GLib: g_tree_destroy: assertion 'tree != NULL' failed" Check that the trees are non NULL before destroying them. Cc: qemu-stable@nongnu.org Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Message-Id: <20200908193309.20569-2-eric.auger@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
63e79833c4
commit
59bf980d22
1 changed files with 6 additions and 2 deletions
|
@ -801,8 +801,12 @@ static void virtio_iommu_device_unrealize(DeviceState *dev)
|
|||
VirtIOIOMMU *s = VIRTIO_IOMMU(dev);
|
||||
|
||||
g_hash_table_destroy(s->as_by_busptr);
|
||||
g_tree_destroy(s->domains);
|
||||
g_tree_destroy(s->endpoints);
|
||||
if (s->domains) {
|
||||
g_tree_destroy(s->domains);
|
||||
}
|
||||
if (s->endpoints) {
|
||||
g_tree_destroy(s->endpoints);
|
||||
}
|
||||
|
||||
virtio_delete_queue(s->req_vq);
|
||||
virtio_delete_queue(s->event_vq);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue