Blame SOURCES/autofs-5.1.7-fix-dead-code-in-mnts_add_mount.patch

96dc52
autofs-5.1.7 - fix dead code in mnts_add_mount()
96dc52
96dc52
From: Ian Kent <raven@themaw.net>
96dc52
96dc52
Coverity: dead_error_line: Execution cannot reach this statement: "free(mp);".
96dc52
96dc52
Signed-off-by: Ian Kent <raven@themaw.net>
96dc52
---
96dc52
 CHANGELOG    |    1 +
96dc52
 lib/mounts.c |    8 ++------
96dc52
 2 files changed, 3 insertions(+), 6 deletions(-)
96dc52
96dc52
diff --git a/CHANGELOG b/CHANGELOG
96dc52
index f95b1aa6..f11aa1c7 100644
96dc52
--- a/CHANGELOG
96dc52
+++ b/CHANGELOG
96dc52
@@ -59,6 +59,7 @@
96dc52
 - fix flags check in umount_multi().
96dc52
 - dont try umount after stat() ENOENT fail.
96dc52
 - remove redundant assignment in master_add_amd_mount_section_mounts().
96dc52
+- fix dead code in mnts_add_mount().
96dc52
 
96dc52
 25/01/2021 autofs-5.1.7
96dc52
 - make bind mounts propagation slave by default.
96dc52
diff --git a/lib/mounts.c b/lib/mounts.c
96dc52
index ef69cec1..018b9c80 100644
96dc52
--- a/lib/mounts.c
96dc52
+++ b/lib/mounts.c
96dc52
@@ -1205,13 +1205,13 @@ struct mnt_list *mnts_add_mount(struct autofs_point *ap,
96dc52
 	if (*name == '/') {
96dc52
 		mp = strdup(name);
96dc52
 		if (!mp)
96dc52
-			goto fail;
96dc52
+			return NULL;
96dc52
 	} else {
96dc52
 		int len = ap->len + strlen(name) + 2;
96dc52
 
96dc52
 		mp = malloc(len);
96dc52
 		if (!mp)
96dc52
-			goto fail;
96dc52
+			return NULL;
96dc52
 		strcpy(mp, ap->path);
96dc52
 		strcat(mp, "/");
96dc52
 		strcat(mp, name);
96dc52
@@ -1228,10 +1228,6 @@ struct mnt_list *mnts_add_mount(struct autofs_point *ap,
96dc52
 	free(mp);
96dc52
 
96dc52
 	return this;
96dc52
-fail:
96dc52
-	if (mp)
96dc52
-		free(mp);
96dc52
-	return NULL;
96dc52
 }
96dc52
 
96dc52
 void mnts_remove_mount(const char *mp, unsigned int flags)