Received: from eggs.gnu.org ([2001:4830:134:3::10]:49618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cDr46-0007ZC-8W for qemu-devel@nongnu.org; Mon, 05 Dec 2016 06:04:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cDr43-0001D0-Hi for qemu-devel@nongnu.org; Mon, 05 Dec 2016 06:04:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49490) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cDr43-0001Cc-C1 for qemu-devel@nongnu.org; Mon, 05 Dec 2016 06:04:07 -0500 From: Gerd Hoffmann Date: Mon, 5 Dec 2016 12:03:59 +0100 Message-Id: <1480935840-3961-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1480935840-3961-1-git-send-email-kraxel@redhat.com> References: <1480935840-3961-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 3/4] virtio-gpu: fix memory leak in update_cursor_data_virgl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Li Qiang , Gerd Hoffmann , "Michael S. Tsirkin" 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 Message-id: 58187760.41d71c0a.cca75.4cb9@mx.google.com Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Gerd Hoffmann --- 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, =20 if (width !=3D s->current_cursor->width || height !=3D s->current_cursor->height) { + free(data); return; } =20 --=20 1.8.3.1