Blob Blame History Raw
autofs-5.1.7 - fix dead code in mnts_add_mount()

From: Ian Kent <raven@themaw.net>

Coverity: dead_error_line: Execution cannot reach this statement: "free(mp);".

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG    |    1 +
 lib/mounts.c |    8 ++------
 2 files changed, 3 insertions(+), 6 deletions(-)

--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -59,6 +59,7 @@
 - fix flags check in umount_multi().
 - dont try umount after stat() ENOENT fail.
 - remove redundant assignment in master_add_amd_mount_section_mounts().
+- fix dead code in mnts_add_mount().
 
 xx/xx/2018 autofs-5.1.5
 - fix flag file permission.
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -1205,13 +1205,13 @@ struct mnt_list *mnts_add_mount(struct a
 	if (*name == '/') {
 		mp = strdup(name);
 		if (!mp)
-			goto fail;
+			return NULL;
 	} else {
 		int len = ap->len + strlen(name) + 2;
 
 		mp = malloc(len);
 		if (!mp)
-			goto fail;
+			return NULL;
 		strcpy(mp, ap->path);
 		strcat(mp, "/");
 		strcat(mp, name);
@@ -1228,10 +1228,6 @@ struct mnt_list *mnts_add_mount(struct a
 	free(mp);
 
 	return this;
-fail:
-	if (mp)
-		free(mp);
-	return NULL;
 }
 
 void mnts_remove_mount(const char *mp, unsigned int flags)