From patchwork Mon Sep 18 13:56:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9956777 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 131AF601E9 for ; Mon, 18 Sep 2017 13:58:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 055FC28A23 for ; Mon, 18 Sep 2017 13:58:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE79F28A37; Mon, 18 Sep 2017 13:58:35 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E8C5B28A23 for ; Mon, 18 Sep 2017 13:58:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dtwX9-0005TZ-Cc; Mon, 18 Sep 2017 13:56:23 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dtwX8-0005TE-73 for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 13:56:22 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id F5/79-03422-580DFB95; Mon, 18 Sep 2017 13:56:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDIsWRWlGSWpSXmKPExsXitHRDpG7Thf2 RBt8PcFp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBmL/25gKpjNWnH5yw/2BsZfzF2MnBwSAv4S p05eYgWx2QSUJX529rKB2CICehJNB54zgtjMAl4SP1b0sIPYwgKOEjub5oLVswioSvw4eRCsn lfAQuL4zbeMEDPlJXa1XQSr4RSwlFiz9x0TiC0EVNP7bSsrhK0g0TH9GBNEr6DEyZlPWCB2SU gcfPGCeQIj7ywkqVlIUgsYmVYxqhenFpWlFuma6SUVZaZnlOQmZuboGhqY6eWmFhcnpqfmJCY V6yXn525iBIYOAxDsYJx3wv8QoyQHk5Ior2jk/kghvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErzT zwPlBItS01Mr0jJzgEEMk5bg4FES4Z0PkuYtLkjMLc5Mh0idYrTkOLbp8h8mjhsPrwPJjpt3/ zAJseTl56VKifPWgTQIgDRklObBjYNF2iVGWSlhXkagA4V4ClKLcjNLUOVfMYpzMCoJ88qCTO HJzCuB2/oK6CAmoINaduwBOagkESEl1cAoFnJJxNlz7cOWtuV+/9cueL1n6jkb8cXHDm9RFki f13TnS7jMQ7Y5m8oMn629+Gf9erWwtTwL2E1s21ld2jZM7Go5xz1P6ava4r1BWZn3T50Mnrwp wP7vjXn8szO/qEr3uSU0Jf99VrpGaa6tceWyCq9A16db1y67J3dGo9BT+AHvJS4Op6bjSizFG YmGWsxFxYkAqoN6UK8CAAA= X-Env-Sender: prvs=427238337=wei.liu2@citrix.com X-Msg-Ref: server-15.tower-21.messagelabs.com!1505742976!83250223!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22241 invoked from network); 18 Sep 2017 13:56:17 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-15.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 18 Sep 2017 13:56:17 -0000 X-IronPort-AV: E=Sophos;i="5.42,413,1500940800"; d="scan'208";a="440146255" From: Wei Liu To: Xen-devel Date: Mon, 18 Sep 2017 14:56:14 +0100 Message-ID: <20170918135614.30868-4-wei.liu2@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170918135614.30868-1-wei.liu2@citrix.com> References: <20170918135614.30868-1-wei.liu2@citrix.com> MIME-Version: 1.0 Cc: Wei Liu , Ian Jackson Subject: [Xen-devel] [PATCH v2 3/3] xl: avoid leaking memory in vdispl parser X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Coverity-ID: 1418095 Signed-off-by: Wei Liu --- tools/xl/xl_parse.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 9965b83c44..0678fbc1b0 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -832,6 +832,8 @@ int parse_vdispl_config(libxl_device_vdispl *vdispl, char *token) rc= sscanf(resolution, "%ux%u", &vdispl->connectors[i].width, &vdispl->connectors[i].height); + free(resolution); + if (rc != 2) { fprintf(stderr, "Can't parse connector resolution\n"); goto out;