[fedfs-utils] [PATCH 8/8] fedfsd: don't double-free upon ENOMEM

Jim Meyering jim at meyering.net
Wed Nov 30 12:51:38 PST 2011


From: Jim Meyering <meyering at redhat.com>

* 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.
---
 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 3509082..8c46c0c 100644
--- a/src/fedfsd/svc.c
+++ b/src/fedfsd/svc.c
@@ -374,10 +374,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) {
-- 
1.7.8.rc4




More information about the fedfs-utils-devel mailing list