From patchwork Wed Nov 30 20:51:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Meyering X-Patchwork-Id: 128575 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "rcsinet15.oracle.com", Issuer "VeriSign Class 3 International Server CA - G3" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 81119B6F62 for ; Thu, 1 Dec 2011 07:59:07 +1100 (EST) Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pAUKww9F013512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 30 Nov 2011 20:58:59 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 pAUKwvKf010956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 30 Nov 2011 20:58:58 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1RVrEy-0003kv-KQ; Wed, 30 Nov 2011 12:58:52 -0800 Received: from acsinet13.oracle.com ([141.146.126.235]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1RVrEw-0003kH-Te for fedfs-utils-devel@oss.oracle.com; Wed, 30 Nov 2011 12:58:50 -0800 Received: from mx.meyering.net (mx.meyering.net [88.168.87.75]) by acsinet13.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pAUKwmkN021709 for ; Wed, 30 Nov 2011 20:58:50 GMT Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id DCDD360726; Wed, 30 Nov 2011 21:51:48 +0100 (CET) From: Jim Meyering To: fedfs-utils-devel@oss.oracle.com Date: Wed, 30 Nov 2011 21:51:36 +0100 Message-Id: <1322686298-14634-7-git-send-email-jim@meyering.net> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1322686298-14634-1-git-send-email-jim@meyering.net> References: <1322686298-14634-1-git-send-email-jim@meyering.net> X-Flow-Control-Info: class=Default ip=88.168.87.75 ct-class=G1 ct-vol1=0 ct-vol2=0 ct-vol3=0 ct-risk=0 ct-spam1=0 ct-spam2=0 ct-bulk=0 rcpts=1 size=582 Subject: [fedfs-utils] [PATCH 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.4ED69913.0093: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. --- 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; }