From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40192) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9tjs-0002Qm-PB for qemu-devel@nongnu.org; Fri, 18 Dec 2015 07:02:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9tjp-0000l8-DC for qemu-devel@nongnu.org; Fri, 18 Dec 2015 07:02:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53172) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9tjp-0000l4-9C for qemu-devel@nongnu.org; Fri, 18 Dec 2015 07:02:21 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id DFEC58E90C for ; Fri, 18 Dec 2015 12:02:20 +0000 (UTC) From: Gerd Hoffmann Date: Fri, 18 Dec 2015 11:57:20 +0100 Message-Id: <1450436240-19244-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH] virtio-gpu: fix memory leak in error path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , "Michael S. Tsirkin" Found by Coverity Scan, buf not freed on error. Signed-off-by: Gerd Hoffmann --- hw/display/virtio-gpu-3d.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c index 527ac90..bd88d45 100644 --- a/hw/display/virtio-gpu-3d.c +++ b/hw/display/virtio-gpu-3d.c @@ -197,7 +197,7 @@ static void virgl_cmd_submit_3d(VirtIOGPU *g, qemu_log_mask(LOG_GUEST_ERROR, "%s: size mismatch (%zd/%d)", __func__, s, cs.size); cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; - return; + goto out; } if (virtio_gpu_stats_enabled(g->conf)) { @@ -207,6 +207,7 @@ static void virgl_cmd_submit_3d(VirtIOGPU *g, virgl_renderer_submit_cmd(buf, cs.hdr.ctx_id, cs.size / 4); +out: g_free(buf); } -- 1.8.3.1