From patchwork Thu Dec 1 12:27:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Meyering X-Patchwork-Id: 128692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "acsinet15.oracle.com", Issuer "VeriSign Class 3 International Server CA - G3" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 085C2B6F69 for ; Thu, 1 Dec 2011 23:27:40 +1100 (EST) Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pB1CRZkg026395 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 1 Dec 2011 12:27:36 GMT Received: from oss.oracle.com (oss.oracle.com [141.146.12.120]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id pB1CRZ3S014929 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 1 Dec 2011 12:27:35 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1RW5je-0004su-42; Thu, 01 Dec 2011 04:27:30 -0800 Received: from rcsinet12.oracle.com ([148.87.113.124]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1RW5jc-0004s9-67 for fedfs-utils-devel@oss.oracle.com; Thu, 01 Dec 2011 04:27:28 -0800 Received: from mx.meyering.net (mx.meyering.net [88.168.87.75]) by rcsinet12.oracle.com (Sentrion-MTA-4.2.0/Sentrion-MTA-4.2.0) with ESMTP id pB1CRQW8023924 for ; Thu, 1 Dec 2011 12:27:27 GMT Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id F03F6603FA; Thu, 1 Dec 2011 13:27:23 +0100 (CET) From: Jim Meyering To: fedfs-utils-devel@oss.oracle.com Date: Thu, 1 Dec 2011 13:27:17 +0100 Message-Id: <1322742439-2171-7-git-send-email-jim@meyering.net> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1322742439-2171-1-git-send-email-jim@meyering.net> References: <1322742439-2171-1-git-send-email-jim@meyering.net> Subject: [fedfs-utils] [PATCH v2 6/8] nsdb: don't leak a read buffer upon certfile open failure X-BeenThere: fedfs-utils-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list Reply-To: fedfs-utils Developers List-Id: fedfs-utils Developers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fedfs-utils-devel-bounces@oss.oracle.com Errors-To: fedfs-utils-devel-bounces@oss.oracle.com X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-CT-RefId: str=0001.0A090208.4ED772B8.0072:SCFSTAT1119972, ss=1, re=-4.000, fgs=0 X-Auth-Type: Internal IP From: Jim Meyering * src/libnsdb/nsdb.c (nsdb_read_certfile): Free "buf" also on the failed-open path. Spotted by coverity. Signed-off-by: Jim Meyering --- src/libnsdb/nsdb.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/libnsdb/nsdb.c b/src/libnsdb/nsdb.c index cab81b7..2ec13e2 100644 --- a/src/libnsdb/nsdb.c +++ b/src/libnsdb/nsdb.c @@ -494,6 +494,7 @@ nsdb_read_certfile(const char *pathname, char **certdata, if (fd == -1) { xlog(D_GENERAL, "%s: Failed to open %s: %m", __func__, pathname); + free(buf); goto out; }