From patchwork Tue Dec 13 22:52:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 131208 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 981BE1007D3 for ; Wed, 14 Dec 2011 09:52:24 +1100 (EST) Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pBDMqIPd003076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 13 Dec 2011 22:52:19 GMT Received: from oss.oracle.com (oss.oracle.com [141.146.12.120]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id pBDMqITt002591 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 13 Dec 2011 22:52:18 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1RabCm-00061U-VT; Tue, 13 Dec 2011 14:52:12 -0800 Received: from acsinet13.oracle.com ([141.146.126.235]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1RabCk-00061N-Vo for fedfs-utils-devel@oss.oracle.com; Tue, 13 Dec 2011 14:52:11 -0800 Received: from mail-vw0-f43.google.com (mail-vw0-f43.google.com [209.85.212.43]) by acsinet13.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pBDMp6lH022175 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Tue, 13 Dec 2011 22:52:10 GMT Received: by mail-vw0-f43.google.com with SMTP id fq11so201700vbb.2 for ; Tue, 13 Dec 2011 14:52:10 -0800 (PST) Received: by 10.52.22.162 with SMTP id e2mr2582025vdf.22.1323816730476; Tue, 13 Dec 2011 14:52:10 -0800 (PST) Received: from degas.1015granger.net (adsl-99-26-161-222.dsl.sfldmi.sbcglobal.net. [99.26.161.222]) by mx.google.com with ESMTPS id k16sm537645vdt.8.2011.12.13.14.52.09 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Dec 2011 14:52:09 -0800 (PST) From: Chuck Lever To: fedfs-utils-devel@oss.oracle.com Date: Tue, 13 Dec 2011 17:52:08 -0500 Message-ID: <20111213225208.15402.69374.stgit@degas.1015granger.net> In-Reply-To: <20111213224842.15402.340.stgit@degas.1015granger.net> References: <20111213224842.15402.340.stgit@degas.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Flow-Control-Info: class=ISPs ip=209.85.212.43 ct-class=R6 ct-vol1=0 ct-vol2=0 ct-vol3=0 ct-risk=68 ct-spam1=0 ct-spam2=0 ct-bulk=0 rcpts=1 size=917 Subject: [fedfs-utils] [PATCH 08/12] fedfsd: don't double-free upon ENOMEM 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: ucsinet21.oracle.com [156.151.31.93] X-CT-RefId: str=0001.0A090207.4EE7D724.0013:SCFSTAT3865452, ss=1, re=-4.000, fgs=0 From: Jim Meyering * src/fedfsd/svc.c (fedfsd_pathwalk): If nsdb_normalize_path were to return NULL, "result" would be freed once by the very next stmt, and then again in the following "if"-block. Remove the latter. Spotted by coverity. Introduced by commit 0520ee72: "Initial commit," (March 29, 2011). Signed-off-by: Jim Meyering --- src/fedfsd/svc.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/src/fedfsd/svc.c b/src/fedfsd/svc.c index 12940c7..3b08272 100644 --- a/src/fedfsd/svc.c +++ b/src/fedfsd/svc.c @@ -377,10 +377,8 @@ fedfsd_pathwalk(const FedFsPathName fpath, char **pathname) tmp = nsdb_normalize_path(result); free(result); - if (tmp == NULL) { - free(result); + if (tmp == NULL) return FEDFS_ERR_SVRFAULT; - } retval = fedfsd_pathwalk_check_term(tmp); switch (retval) {