diff mbox

[2/2] virtio-gpu: call cleanup mapping function in resource destroy

Message ID 1479990609-28243-3-git-send-email-liq3ea@gmail.com
State New
Headers show

Commit Message

Li Qiang Nov. 24, 2016, 12:30 p.m. UTC
If the guest destroy the resource before detach banking, the 'iov'
and 'addrs' field in resource is not freed thus leading memory
leak issue. This patch avoid this.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
 hw/display/virtio-gpu.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Marc-André Lureau Nov. 28, 2016, 12:44 p.m. UTC | #1
Hi

On Thu, Nov 24, 2016 at 4:30 PM Li Qiang <liq3ea@gmail.com> wrote:

> If the guest destroy the resource before detach banking, the 'iov'
> and 'addrs' field in resource is not freed thus leading memory
> leak issue. This patch avoid this.
>
>

That looks correct to me.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


Please squash patch 1 (no reason for it to be split).




> Signed-off-by: Li Qiang <liq3ea@gmail.com>
> ---
>  hw/display/virtio-gpu.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index cc725a6..98dadf2 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -360,6 +360,7 @@ static void virtio_gpu_resource_destroy(VirtIOGPU *g,
>                                          struct virtio_gpu_simple_resource
> *res)
>  {
>      pixman_image_unref(res->image);
> +    virtio_gpu_cleanup_mapping(res);
>      QTAILQ_REMOVE(&g->reslist, res, next);
>      g_free(res);
>  }
> --
> 1.8.3.1
>
> --
Marc-André Lureau
diff mbox

Patch

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index cc725a6..98dadf2 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -360,6 +360,7 @@  static void virtio_gpu_resource_destroy(VirtIOGPU *g,
                                         struct virtio_gpu_simple_resource *res)
 {
     pixman_image_unref(res->image);
+    virtio_gpu_cleanup_mapping(res);
     QTAILQ_REMOVE(&g->reslist, res, next);
     g_free(res);
 }