1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

do not try to free a mountpoint that we did not allocate.

X-MFC after:	immediately
This commit is contained in:
Matthew Dillon 2002-12-21 20:55:34 +00:00
parent 87cd4001b5
commit a19f30d8c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=108161

View File

@ -543,12 +543,16 @@ nfs_mountdiskless(char *path, char *which, int mountflag,
struct mount *mp;
struct sockaddr *nam;
int error;
int didalloc = 0;
mp = *mpp;
if (!mp && (error = vfs_rootmountalloc("nfs", path, &mp))) {
printf("nfs_mountroot: NFS not configured");
return (error);
if (mp == NULL) {
if ((error = vfs_rootmountalloc("nfs", path, &mp)) != 0) {
printf("nfs_mountroot: NFS not configured");
return (error);
}
didalloc = 1;
}
mp->mnt_kern_flag = 0;
@ -559,7 +563,8 @@ nfs_mountdiskless(char *path, char *which, int mountflag,
printf("nfs_mountroot: mount %s on %s: %d", path, which, error);
mp->mnt_vfc->vfc_refcount--;
vfs_unbusy(mp, td);
free(mp, M_MOUNT);
if (didalloc)
free(mp, M_MOUNT);
FREE(nam, M_SONAME);
return (error);
}