From patchwork Mon Apr 4 15:10:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 8741641 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 018BDC0553 for ; Mon, 4 Apr 2016 15:12:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 33D5B201F2 for ; Mon, 4 Apr 2016 15:12:22 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 61ACC201FA for ; Mon, 4 Apr 2016 15:12:21 +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 1an68v-00077V-BQ; Mon, 04 Apr 2016 15:10:17 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1an68u-00076y-8j for xen-devel@lists.xensource.com; Mon, 04 Apr 2016 15:10:16 +0000 Received: from [193.109.254.147] by server-12.bemta-14.messagelabs.com id 63/5F-02979-7D382075; Mon, 04 Apr 2016 15:10:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRWlGSWpSXmKPExsXitHSDve71ZqZ wg3VX+CzuTXnP7sDosb1vF3sAYxRrZl5SfkUCa8byrxuZCmayVtxb8IC9gXEdSxcjB4eEgL/E 2uP8XYycHGwCuhJNW/6ygdgiAsoSx5u+sHYxcnEwC/QzSvxcfBcsISwQLzHz/U0mEJtFQEXi9 ZT1zCA2r4CnxLZFy1lBbAkBRYnuZxPA6jkFvCQ2nZkPViMEVHPt3xqwvUICahJz18dDtApKnJ z5hAXEZhaQkDj44gUzxGncEn+77Scw8s1CUjULSdUCRqZVjBrFqUVlqUW6hhZ6SUWZ6RkluYm ZObqGhiZ6uanFxYnpqTmJScV6yfm5mxiBAVXPwMC4g/HIds9DjJIcTEqivO5VTOFCfEn5KZUZ icUZ8UWlOanFhxhlODiUJHgvNwHlBItS01Mr0jJzgKENk5bg4FES4d0BkuYtLkjMLc5Mh0idY tTlWPDj9lomIZa8/LxUKXHeSpAiAZCijNI8uBGwOLvEKCslzMvIwMAgxFOQWpSbWYIq/4pRnI NRSZj3KMgUnsy8ErhNr4COYAI6ol4Y7IiSRISUVANjmWEeh4rSfJ6TU5rUJE/63F+t8zjqsfK MPcw/SoMYeS2VGLqWLOmSbTdTfqknv+sDV9GxuVeeTVM3eNVw7ey5nrf/9bd3SondN3jnICcr 8o3lTGpD1Bm+7drPZOa/mLpUwrZ7u1G25jTho+vyd4W+2mEuWvxJs0Z41vY4ufjFMWtPuV9/a NyjxFKckWioxVxUnAgAE9J6AK4CAAA= X-Env-Sender: prvs=895d09049=Ian.Jackson@citrix.com X-Msg-Ref: server-6.tower-27.messagelabs.com!1459782609!35563106!2 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 44344 invoked from network); 4 Apr 2016 15:10:15 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-6.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 4 Apr 2016 15:10:15 -0000 X-IronPort-AV: E=Sophos;i="5.24,441,1454976000"; d="scan'208";a="351305873" From: Ian Jackson To: Date: Mon, 4 Apr 2016 16:10:00 +0100 Message-ID: <1459782600-16073-2-git-send-email-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1459782600-16073-1-git-send-email-ian.jackson@eu.citrix.com> References: <1459782600-16073-1-git-send-email-ian.jackson@eu.citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Ian Jackson , Chunyan Liu , coverity@xenproject.org Subject: [Xen-devel] [PATCH 2/2] libxl: Do not leak data on error path from libxl__read_sysfs_file_contents 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Bug introduced in bc023ecd "libxl_utils: add internal function to read sysfs file contents" CID: 1358108 Signed-off-by: Ian Jackson CC: coverity@xenproject.org CC: Chunyan Liu --- tools/libxl/libxl_utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index ceb8825..bd58a52 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -466,6 +466,7 @@ int libxl__read_sysfs_file_contents(libxl__gc *gc, const char *filename, e = errno; assert(e != ENOENT); if (f) fclose(f); + free(data); return e; }