From patchwork Thu Dec 1 15:58:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Meyering X-Patchwork-Id: 128716 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 2DB6CB6F7D for ; Fri, 2 Dec 2011 02:58:48 +1100 (EST) Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pB1FwhYp010368 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 1 Dec 2011 15:58:44 GMT Received: from oss.oracle.com (oss.oracle.com [141.146.12.120]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id pB1FwgUF004335 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 1 Dec 2011 15:58:42 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1RW91x-0006Js-Ba; Thu, 01 Dec 2011 07:58:37 -0800 Received: from rcsinet13.oracle.com ([148.87.113.125]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1RW91v-0006In-JJ for fedfs-utils-devel@oss.oracle.com; Thu, 01 Dec 2011 07:58:35 -0800 Received: from mx.meyering.net (mx.meyering.net [88.168.87.75]) by rcsinet13.oracle.com (Sentrion-MTA-4.2.0/Sentrion-MTA-4.2.0) with ESMTP id pB1FwXSu012781 for ; Thu, 1 Dec 2011 15:58:35 GMT Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id BBE7D603A3; Thu, 1 Dec 2011 16:58:30 +0100 (CET) From: Jim Meyering To: fedfs-utils-devel@oss.oracle.com Date: Thu, 1 Dec 2011 16:58:23 +0100 Message-Id: <1322755106-8171-7-git-send-email-jim@meyering.net> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1322755106-8171-1-git-send-email-jim@meyering.net> References: <1322755106-8171-1-git-send-email-jim@meyering.net> Subject: [fedfs-utils] [PATCH 6/9] 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: ucsinet22.oracle.com [156.151.31.94] X-CT-RefId: str=0001.0A090209.4ED7A434.00B7:SCFSTAT3865452, ss=1, re=-4.000, fgs=0 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 c81f228..02c0588 100644 --- a/src/libnsdb/nsdb.c +++ b/src/libnsdb/nsdb.c @@ -524,6 +524,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; }