From patchwork Tue May 27 15:38:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 353021 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 351E1140098 for ; Wed, 28 May 2014 01:38:12 +1000 (EST) Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s4RFc9cX031570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 27 May 2014 15:38:10 GMT Received: from oss.oracle.com (oss-external.oracle.com [137.254.96.51]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s4RFc9p3008115 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 May 2014 15:38:09 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1WpJS5-0004gF-3R; Tue, 27 May 2014 08:38:09 -0700 Received: from acsinet22.oracle.com ([141.146.126.238]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1WpJS3-0004g6-RV for fedfs-utils-devel@oss.oracle.com; Tue, 27 May 2014 08:38:07 -0700 Received: from aserp1020.oracle.com (aserp1020.oracle.com [141.146.126.67]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s4RFc7S3008043 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 27 May 2014 15:38:07 GMT Received: from mail-ie0-f170.google.com (mail-ie0-f170.google.com [209.85.223.170]) by aserp1020.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s4RFc6c8027738 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 27 May 2014 15:38:07 GMT Authentication-Results: aserp1020.oracle.com; dkim=pass reason="2048-bit key" header.d=gmail.com header.i=@gmail.com header.b=JUfdETj6 Received: by mail-ie0-f170.google.com with SMTP id at1so8993720iec.15 for ; Tue, 27 May 2014 08:38:06 -0700 (PDT) X-Received: by 10.50.79.226 with SMTP id m2mr34668736igx.11.1401205086455; Tue, 27 May 2014 08:38:06 -0700 (PDT) Received: from seurat.1015granger.net ([2604:8800:100:81fc:20c:29ff:fe44:ec31]) by mx.google.com with ESMTPSA id b8sm8493369igx.3.2014.05.27.08.38.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 May 2014 08:38:04 -0700 (PDT) To: fedfs-utils-devel@oss.oracle.com From: Chuck Lever Date: Tue, 27 May 2014 11:38:04 -0400 Message-ID: <20140527153804.1177.8147.stgit@seurat.1015granger.net> In-Reply-To: <20140527153133.1177.54989.stgit@seurat.1015granger.net> References: <20140527153133.1177.54989.stgit@seurat.1015granger.net> User-Agent: StGit/0.16 MIME-Version: 1.0 X-Flow-Control-Info: class=Pass-to-MM reputation=ipRisk-All ip=209.85.223.170 ct-class=R5 ct-vol1=-84 ct-vol2=8 ct-vol3=7 ct-risk=45 ct-spam1=68 ct-spam2=7 ct-bulk=6 rcpts=1 size=2266 X-Sendmail-CM-Score: 0.00% X-Sendmail-CM-Analysis: v=2.1 cv=E4H0+8tl c=1 sm=1 tr=0 a=U5zQPw3r0los7BvIzw5nPQ==:117 a=dzsqy3y4QnMA:10 a=HGYNFYO_Z7EA:10 a=dPGociXpb70A:10 a=IkcTkHD0fZMA:10 a=xqWC_Br6kY4A:10 a=yPCof4ZbAAAA:8 a=Lb1rMZzfAAAA:8 a=1XWaLZrsAAAA:8 a=T6jhBPFonpao4K8VjiYA:9 a=QEXdDO 2ut3YA:10 a=7DSvI1NPTFQA:10 X-Sendmail-CT-RefID: str=0001.0A010202.5384B15F.010E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-Sendmail-CT-Classification: not spam Subject: [fedfs-utils] [PATCH 12/17] NFS plug-in: Fix double free 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: , Sender: fedfs-utils-devel-bounces@oss.oracle.com Errors-To: fedfs-utils-devel-bounces@oss.oracle.com X-Source-IP: acsinet22.oracle.com [141.146.126.238] When nfs_jp_convert_fedfs_fsl() fails, the locations set is freed once in nfs_jp_convert_fedfs_fsls(), and once in nfs_jp_get_fedfs(). Only one nfs_jp_put_locations() is needed. Fixes: d960256574a9aa02828c38b5ebc79c77793cc607 Signed-off-by: Chuck Lever --- src/plug-ins/nfs-plugin.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/plug-ins/nfs-plugin.c b/src/plug-ins/nfs-plugin.c index dbe84d99ac5a..4b3a71e26ed8 100644 --- a/src/plug-ins/nfs-plugin.c +++ b/src/plug-ins/nfs-plugin.c @@ -290,9 +290,6 @@ nfs_jp_convert_fedfs_fsl(struct fedfs_fsl *fsl, struct nfs_fsloc **fsloc) * @param fsls a list of FedFS fileset locations * @param new empty set of NFS locations to fill in * @return a junction status code - * - * If nfs_jp_convert_fedfs_fsls() returns JP_OK, the caller must free the returned - * set of locations by calling nfs_jp_put_locations(). */ static enum jp_status nfs_jp_convert_fedfs_fsls(struct fedfs_fsl *fsls, nfs_fsloc_set_t new) @@ -309,10 +306,8 @@ nfs_jp_convert_fedfs_fsls(struct fedfs_fsl *fsls, nfs_fsloc_set_t new) enum jp_status status; status = nfs_jp_convert_fedfs_fsl(fsl, &fsloc); - if (status != JP_OK) { - nfs_jp_put_locations(new); + if (status != JP_OK) return status; - } if (new->ns_list == NULL) new->ns_list = fsloc; @@ -379,9 +374,6 @@ nfs_jp_follow_ldap_referral(nsdb_t *host) * @param host an initialized NSDB host object * @param new empty set of NFS locations * @return a junction status code - * - * If nfs_jp_resolve_fsn() returns JP_OK, the caller must free the returned - * set of locations by calling nfs_jp_put_locations(). */ static enum jp_status nfs_jp_resolve_fsn(const char *fsn_uuid, nsdb_t host, @@ -493,9 +485,6 @@ out_close: * @param junct_path NUL-terminated C string containing POSIX path of junction * @param new empty set of NFS locations * @return a junction status code - * - * If nfs_jp_resolve_fedfs_junction() returns JP_OK, the caller must free - * the returned set of locations by calling nfs_jp_put_locations(). */ static enum jp_status nfs_jp_resolve_fedfs_junction(const char *junct_path, nfs_fsloc_set_t new)