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

X-MFC after:	immediately
This commit is contained in:
dillon 2002-12-21 20:55:34 +00:00
parent adc4b142ac
commit 63da09d1e6

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);
}