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

56 lines
1.4 KiB
Diff
Raw Normal View History

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(-)
diff --git a/CHANGELOG b/CHANGELOG
index f95b1aa6..f11aa1c7 100644
--- a/CHANGELOG
+++ b/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().
25/01/2021 autofs-5.1.7
- make bind mounts propagation slave by default.
diff --git a/lib/mounts.c b/lib/mounts.c
index ef69cec1..018b9c80 100644
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -1205,13 +1205,13 @@ struct mnt_list *mnts_add_mount(struct autofs_point *ap,
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 autofs_point *ap,
free(mp);
return this;
-fail:
- if (mp)
- free(mp);
- return NULL;
}
void mnts_remove_mount(const char *mp, unsigned int flags)