Skip to contentSkip to conversation

virtio-gpu: fix memory leak in update_cursor_data_virgl

PATCH In review Li Qiang 3 participants 3 messages Nov 1, 2016

lore
Share & tools
lore

Li Qiang

author
#0 lore raw

PATCH 1/1 virtio-gpu: fix memory leak in update_cursor_data_virgl

From: Li Qiang <[email protected]>

In update_cursor_data_virgl function, if the 'width'/ 'height' is not equal to current cursor's width/height it will return without free the 'data' allocated previously. This will lead a memory leak issue. This patch fix this issue.

---
 hw/display/virtio-gpu.c | 1 +
 1 file changed, 1 insertion(+)
hw/display/virtio-gpu.c +1 -0
index 60bce94..5f32e1a 100644
@@ -84,6 +84,7 @@ static void update_cursor_data_virgl(VirtIOGPU *g,
 
     if (width != s->current_cursor->width ||
         height != s->current_cursor->height) {
+        free(data);
         return;
     }
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 17 lines · Li Qiang

From: Li Qiang <[email protected]>

In update_cursor_data_virgl function, if the 'width'/ 'height' is not equal to current cursor's width/height it will return without free the 'data' allocated previously. This will lead a memory leak issue. This patch fix this issue.

---
 hw/display/virtio-gpu.c | 1 +
 1 file changed, 1 insertion(+)
hw/display/virtio-gpu.c +0 -0
index 60bce94..5f32e1a 100644

hw/display/virtio-gpu.c static void update_cursor_data_virgl(VirtIOGPU *g, · line 90

Quoted 7 lines
hw/display/virtio-gpu.c +1 -0
@@ -84,6 +84,7 @@ static void update_cursor_data_virgl(VirtIOGPU *g,
 
     if (width != s->current_cursor->width ||
         height != s->current_cursor->height) {
+        free(data);
         return;
     }
 

Added to vga patch queue.

thanks,
Gerd

Reviewed-by on v1 1/1
#2 lore raw
In reply to Li Qiang

Hi

Quoted 9 lines · Li Qiang

From: Li Qiang <[email protected]>

In update_cursor_data_virgl function, if the 'width'/ 'height' is not equal to current cursor's width/height it will return without free the 'data' allocated previously. This will lead a memory leak issue. This patch fix this issue.

---

Quoted 19 lines
 hw/display/virtio-gpu.c | 1 +
 1 file changed, 1 insertion(+)
hw/display/virtio-gpu.c +1 -1
index 60bce94..5f32e1a 100644
@@ -84,6 +84,7 @@ static void update_cursor_data_virgl(VirtIOGPU *g,
 
     if (width != s->current_cursor->width ||
         height != s->current_cursor->height) {
+        free(data);
         return;
     }
 
--

1.8.3.1

Quoted 1 line

--

Marc-André Lureau