diff mbox series

[v2,2/2] virtio-iommu: delete vqs in unrealize to fix memleak

Message ID 20200327045620.9082-3-pannengyuan@huawei.com
State New
Headers show
Series fix two virtio queues memleak | expand

Commit Message

Pan Nengyuan March 27, 2020, 4:56 a.m. UTC
req_vq/event_vq forgot to free in unrealize. Fix that.

Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
---
Cc: Eric Auger <eric.auger@redhat.com>
---
 hw/virtio/virtio-iommu.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stefano Garzarella March 27, 2020, 9:03 a.m. UTC | #1
On Fri, Mar 27, 2020 at 12:56:20PM +0800, Pan Nengyuan wrote:
> req_vq/event_vq forgot to free in unrealize. Fix that.
> 
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> ---
> Cc: Eric Auger <eric.auger@redhat.com>
> ---
>  hw/virtio/virtio-iommu.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
> index 4cee8083bc..9d2ff0693c 100644
> --- a/hw/virtio/virtio-iommu.c
> +++ b/hw/virtio/virtio-iommu.c
> @@ -696,6 +696,8 @@ static void virtio_iommu_device_unrealize(DeviceState *dev, Error **errp)
>      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);
>  }

Hi Pan,
this patch LGTM, I left a comment on v1 about cleaning 's->as_by_busptr'
hash table as well.

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

Thanks,
Stefano
diff mbox series

Patch

diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
index 4cee8083bc..9d2ff0693c 100644
--- a/hw/virtio/virtio-iommu.c
+++ b/hw/virtio/virtio-iommu.c
@@ -696,6 +696,8 @@  static void virtio_iommu_device_unrealize(DeviceState *dev, Error **errp)
     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);
 }