From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blnzn-0007dN-67 for qemu-devel@nongnu.org; Sun, 18 Sep 2016 22:07:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1blnzk-0007hZ-0e for qemu-devel@nongnu.org; Sun, 18 Sep 2016 22:07:47 -0400 Received: from mail-it0-x244.google.com ([2607:f8b0:4001:c0b::244]:33663) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blnzj-0007hO-Rw for qemu-devel@nongnu.org; Sun, 18 Sep 2016 22:07:43 -0400 Received: by mail-it0-x244.google.com with SMTP id x192so3603335itb.0 for ; Sun, 18 Sep 2016 19:07:43 -0700 (PDT) Message-ID: <57df486e.8379240a.c3620.ff81@mx.google.com> From: Li Qiang Date: Sun, 18 Sep 2016 19:07:11 -0700 Subject: [Qemu-devel] [PATCH] virtio-gpu: fix memory leak in virtio_gpu_resource_create_2d 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 virtio gpu resource create dispatch, if the pixman format is zero it doesn't free the resource object allocated previously. Thus leading a host memory leak issue. This patch avoid this. 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 7fe6ed8..5b6d17b 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -333,6 +333,7 @@ static void virtio_gpu_resource_create_2d(VirtIOGPU *g, qemu_log_mask(LOG_GUEST_ERROR, "%s: host couldn't handle guest format %d\n", __func__, c2d.format); + g_free(res); cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; return; } -- 1.8.3.1