From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1WuV-000198-Bg for qemu-devel@nongnu.org; Tue, 01 Nov 2016 07:07:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1WuQ-0003GW-WD for qemu-devel@nongnu.org; Tue, 01 Nov 2016 07:07:19 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36784) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c1WuQ-0003G8-Ot for qemu-devel@nongnu.org; Tue, 01 Nov 2016 07:07:14 -0400 Received: by mail-wm0-x242.google.com with SMTP id c17so22208527wmc.3 for ; Tue, 01 Nov 2016 04:07:14 -0700 (PDT) Message-ID: <58187760.41d71c0a.cca75.4cb9@mx.google.com> From: Li Qiang Date: Tue, 1 Nov 2016 04:06:58 -0700 Subject: [Qemu-devel] [PATCH] virtio-gpu: fix memory leak in update_cursor_data_virgl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kraxel@redhat.com, qemu-devel@nongnu.org Cc: Li Qiang From: Li Qiang 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 --- 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 60bce94..5f32e1a 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; } -- 1.8.3.1