From: Li Qiang Date: Tue, 1 Nov 2016 11:06:58 +0000 (-0700) Subject: virtio-gpu: fix memory leak in update_cursor_data_virgl X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=2d1cd6c7a91a4beb99a0c3a21be529222a708545;p=qemu.git virtio-gpu: fix memory leak in update_cursor_data_virgl 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. Signed-off-by: Li Qiang Message-id: 58187760.41d71c0a.cca75.4cb9@mx.google.com Reviewed-by: Marc-André Lureau Signed-off-by: Gerd Hoffmann --- diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 60bce94d6b..5f32e1aae9 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -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; }