From patchwork Mon Dec 5 17:24:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [9/9] fedfsd: don't double-free upon ENOMEM Date: Mon, 05 Dec 2011 07:24:22 -0000 From: Chuck Lever X-Patchwork-Id: 129382 Message-Id: <20111205172421.7753.66614.stgit@degas.1015granger.net> To: fedfs-utils-devel@oss.oracle.com 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 8ba6468..2772064 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) {