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
This commit is contained in:
John Baldwin 2011-09-02 17:11:59 +00:00
parent cdd4eea9fc
commit d2e17ce906

View File

@ -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) {