Skip to contentSkip to conversation

virtio-gpu: fix memory leak in set scanout

PATCH In review Li Qiang 3 participants 4 messages Jan 22, 2017 – Feb 6, 2017

lore
Share & tools
lore

Li Qiang

author
#0 lore raw

PATCH 1/1 virtio-gpu: fix memory leak in set scanout

From: Li Qiang <[email protected]>

In virtio_gpu_set_scanout function, when creating the 'rect' its refcount is set to 2, by pixman_image_create_bits and qemu_create_displaysurface_pixman function. This can lead a memory leak issues. This patch avoid this issue.

---
 hw/display/virtio-gpu.c | 1 +
 1 file changed, 1 insertion(+)
hw/display/virtio-gpu.c +1 -0
index 7a15c61..4aecea3 100644
@@ -608,6 +608,7 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g,
             cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
             return;
         }
+        pixman_image_unref(rect);
         dpy_gfx_replace_surface(g->scanout[ss.scanout_id].con, scanout->ds);
     }
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Li Qiang

From: Li Qiang <[email protected]>

In virtio_gpu_set_scanout function, when creating the 'rect' its refcount is set to 2, by pixman_image_create_bits and qemu_create_displaysurface_pixman function. This can lead a memory leak issues. This patch avoid this issue.

Quoted 21 lines
---
 hw/display/virtio-gpu.c | 1 +
 1 file changed, 1 insertion(+)
hw/display/virtio-gpu.c +1 -1
index 7a15c61..4aecea3 100644
@@ -608,6 +608,7 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g,
             cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
             return;
         }
+        pixman_image_unref(rect);
         dpy_gfx_replace_surface(g->scanout[ss.scanout_id].con,
 scanout->ds);
     }
 
--

1.8.3.1

Quoted 1 line

--

Marc-André Lureau

author
#2 lore raw

Hello Gerd,

Ping.

2017-01-23 17:09 GMT+08:00 Marc-André Lureau <[email protected]>:

Quoted 43 lines · Li Qiang
Quoted 10 lines

From: Li Qiang <[email protected]>

In virtio_gpu_set_scanout function, when creating the 'rect' its refcount is set to 2, by pixman_image_create_bits and qemu_create_displaysurface_pixman function. This can lead a memory leak issues. This patch avoid this issue.

Quoted 21 lines
---
 hw/display/virtio-gpu.c | 1 +
 1 file changed, 1 insertion(+)
hw/display/virtio-gpu.c +1 -1
index 7a15c61..4aecea3 100644
@@ -608,6 +608,7 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g,
             cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
             return;
         }
+        pixman_image_unref(rect);
         dpy_gfx_replace_surface(g->scanout[ss.scanout_id].con,
 scanout->ds);
     }
 
--

1.8.3.1

Quoted 1 line

--

Marc-André Lureau