From patchwork Fri Jan 22 12:23:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 8089681 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 296369F1CC for ; Fri, 22 Jan 2016 12:29:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 923EF203AA for ; Fri, 22 Jan 2016 12:29:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EEB7420272 for ; Fri, 22 Jan 2016 12:29:33 +0000 (UTC) Received: from localhost ([::1]:53042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMaqL-0001Gk-9s for patchwork-qemu-devel@patchwork.kernel.org; Fri, 22 Jan 2016 07:29:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56489) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMakx-00018n-9V for qemu-devel@nongnu.org; Fri, 22 Jan 2016 07:24:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMakw-0001h6-7Z for qemu-devel@nongnu.org; Fri, 22 Jan 2016 07:23:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMakw-0001gi-2i for qemu-devel@nongnu.org; Fri, 22 Jan 2016 07:23:58 -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 C11BAC0AC906; Fri, 22 Jan 2016 12:23:57 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0MCNutV030217; Fri, 22 Jan 2016 07:23:57 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 81846808E4; Fri, 22 Jan 2016 13:23:50 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 22 Jan 2016 13:23:44 +0100 Message-Id: <1453465427-6961-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1453465427-6961-1-git-send-email-kraxel@redhat.com> References: <1453465427-6961-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH v2 3/6] virtio-gpu: fix memory leak in error path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Found by Coverity Scan, buf not freed on error. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André 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 28dccfd..d2af327 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); }