From patchwork Mon Sep 19 02:07:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 9338433 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4DF08601C2 for ; Mon, 19 Sep 2016 02:08:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 381C52865F for ; Mon, 19 Sep 2016 02:08:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 290F528EA7; Mon, 19 Sep 2016 02:08:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 2A3D52865F for ; Mon, 19 Sep 2016 02:08:10 +0000 (UTC) Received: from localhost ([::1]:52332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blo08-0007fv-94 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 18 Sep 2016 22:08:08 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:subject:date; bh=H4TXmG6l75q+E94hNmDR5nQosGuoez/UjgtPveR4sMQ=; b=C+Urwu+xkEX/34oA6IHoPHIIWB6jLZE8XCd6uVQHd2jj6FdDPKc33Q5LOW3UNxbFz4 FNHpX56NJxTlThReB1a0DwXvcHBjWAsfPPt9+E8xw4/IbrsJafKgDJn+jXzCjcMK3rad D7poqNA6dyTXOTOh5HNaw0q+5BvHW06wZ0HCyaLkVq6+So93WEwyrJ+H6WKvS3Vs0uJj 4p/fos56qjHdJbom1+cx0DpyjcBsUY5eA9SNkZfXyn0kqFQsz0ZVN8DPCpi/DLjzQ9UZ x9jZgYh941MQTPWyUlU0XAE105DD1ksmkBBxQc9GR0EXglQV9Wa7O8MbT55Rr9NXzDU/ +x5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:subject:date; bh=H4TXmG6l75q+E94hNmDR5nQosGuoez/UjgtPveR4sMQ=; b=XCkC+wvQiLiEFQsLGOIqTzOrgTvCYs6zywMIl3BsFMiV1zOv3rdb/ufLT9qP3ykkm2 k9KCWY4+5T0t3G940lmAOjq03Ei1amsKARpF+IOoB83WBWjspeN4iXQG1MA9dSjXhrmN zFRZD1DOwFso0GKEc9j/9h8Ejp0TGi4seQkdtpLkI/8Yutw1mN8bhnSOckatzetjYntA UnCCLPytPOAnblbqkuEAUDN+QGq1ibwc72ARTh/lIx7EVKDI67gpsaARZUDhLLZpyCYc UslS+6+W7JSMq6U6W8/PDb6Tx0bWSm1oBcdlS8U/QaaTlDXjF0bbIHgBqRxmSXcuNoz5 FDFw== X-Gm-Message-State: AE9vXwPgMdFfElfxUDgy28BLqWnUa1k8KhFO/n9SLEOeTsW0n9wEkOMCFssdAK78gX/oOw== X-Received: by 10.36.104.73 with SMTP id v70mr8845184itb.12.1474250863035; Sun, 18 Sep 2016 19:07:43 -0700 (PDT) Received: from localhost.localdomain.localdomain ([104.192.110.250]) by smtp.gmail.com with ESMTPSA id z125sm9765808itc.0.2016.09.18.19.07.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Sep 2016 19:07:42 -0700 (PDT) Message-ID: <57df486e.8379240a.c3620.ff81@mx.google.com> X-Google-Original-Message-ID: <1474250831-26795-1-git-send-email-Qiang(liqiang6-s@360.cn)> From: Li Qiang X-Google-Original-From: Li Qiang(liqiang6-s@360.cn) To: kraxel@redhat.com, qemu-devel@nongnu.org Date: Sun, 18 Sep 2016 19:07:11 -0700 X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c0b::244 Subject: [Qemu-devel] [PATCH] virtio-gpu: fix memory leak in virtio_gpu_resource_create_2d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Marc-André Lureau --- 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; }