[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 3/5] virtio-gpu: call cleanup mapping function in res
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 3/5] virtio-gpu: call cleanup mapping function in resource destroy |
Date: |
Tue, 3 Jan 2017 15:52:32 +0100 |
From: Li Qiang <address@hidden>
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 <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/display/virtio-gpu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index ed2b6d3..6a26258 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -28,6 +28,8 @@
static struct virtio_gpu_simple_resource*
virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id);
+static void virtio_gpu_cleanup_mapping(struct virtio_gpu_simple_resource *res);
+
#ifdef CONFIG_VIRGL
#include <virglrenderer.h>
#define VIRGL(_g, _virgl, _simple, ...) \
@@ -364,6 +366,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->hostmem -= res->hostmem;
g_free(res);
--
1.8.3.1
- [Qemu-devel] [PULL 0/5] virtio-gpu: misc bugfixes., Gerd Hoffmann, 2017/01/03
- [Qemu-devel] [PULL 1/5] display: virtio-gpu-3d: check virgl capabilities max_size, Gerd Hoffmann, 2017/01/03
- [Qemu-devel] [PULL 2/5] virtio-gpu: track and limit host memory allocations, Gerd Hoffmann, 2017/01/03
- [Qemu-devel] [PULL 5/5] virtio-gpu: fix memory leak in resource attach backing, Gerd Hoffmann, 2017/01/03
- [Qemu-devel] [PULL 3/5] virtio-gpu: call cleanup mapping function in resource destroy,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 4/5] virtio-gpu-3d: fix memory leak in resource attach backing, Gerd Hoffmann, 2017/01/03
- Re: [Qemu-devel] [PULL 0/5] virtio-gpu: misc bugfixes., Peter Maydell, 2017/01/05