summaryrefslogtreecommitdiffstats
path: root/sbin/mount
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-09-02 17:11:59 +0000
committerjhb <jhb@FreeBSD.org>2011-09-02 17:11:59 +0000
commitaa452c94d4215fc263989c3d85fba2ad9032c237 (patch)
tree7c1921389eca17f358e307cfc6b6662f93cbf2be /sbin/mount
parentc440d00776b11f1134a6006a48e60741b69847e8 (diff)
downloadFreeBSD-src-aa452c94d4215fc263989c3d85fba2ad9032c237.zip
FreeBSD-src-aa452c94d4215fc263989c3d85fba2ad9032c237.tar.gz
Clear the mountprog variable after each mountfs() call so that mountprog
options don't leak over into subsequent mounts listed in /etc/fstab. While here, fix a memory leak in debug mode. Reported by: rank1seeker @ gmail Approved by: re (kib) MFC after: 1 week
Diffstat (limited to 'sbin/mount')
-rw-r--r--sbin/mount/mount.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index 6e8f3b5..3f6d2ea 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -589,6 +589,9 @@ mountfs(const char *vfstype, const char *spec, const char *name, int flags,
for (i = 1; i < mnt_argv.c; i++)
(void)printf(" %s", mnt_argv.a[i]);
(void)printf("\n");
+ free(optbuf);
+ free(mountprog);
+ mountprog = NULL;
return (0);
}
@@ -599,6 +602,8 @@ mountfs(const char *vfstype, const char *spec, const char *name, int flags,
}
free(optbuf);
+ free(mountprog);
+ mountprog = NULL;
if (verbose) {
if (statfs(name, &sf) < 0) {
OpenPOWER on IntegriCloud