From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQvQh-0000Jk-Jl for qemu-devel@nongnu.org; Wed, 03 Feb 2016 06:17:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQvQe-00024d-En for qemu-devel@nongnu.org; Wed, 03 Feb 2016 06:16:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQvQe-00024Q-9j for qemu-devel@nongnu.org; Wed, 03 Feb 2016 06:16:56 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id C6C3D2C9D46 for ; Wed, 3 Feb 2016 11:16:55 +0000 (UTC) From: Gerd Hoffmann Date: Wed, 3 Feb 2016 12:16:45 +0100 Message-Id: <1454498208-15164-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1454498208-15164-1-git-send-email-kraxel@redhat.com> References: <1454498208-15164-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/6] 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 Reviewed-by: Marc-Andr=C3=A9 Lureau --- 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 59581a4..e13122d 100644 --- a/hw/display/virtio-gpu-3d.c +++ b/hw/display/virtio-gpu-3d.c @@ -198,7 +198,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 =3D VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; - return; + goto out; } =20 if (virtio_gpu_stats_enabled(g->conf)) { @@ -208,6 +208,7 @@ static void virgl_cmd_submit_3d(VirtIOGPU *g, =20 virgl_renderer_submit_cmd(buf, cs.hdr.ctx_id, cs.size / 4); =20 +out: g_free(buf); } =20 --=20 1.8.3.1