diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -70,7 +70,6 @@ static struct radix_node_head *vfs_create_addrlist_af( struct radix_node_head **prnh, int off); #endif -static void vfs_free_addrlist(struct netexport *nep); static int vfs_free_netcred(struct radix_node *rn, void *w); static void vfs_free_addrlist_af(struct radix_node_head **prnh); static int vfs_hang_addrlist(struct mount *mp, struct netexport *nep, @@ -274,7 +273,7 @@ /* * Free the net address hash lists that are hanging off the mount points. */ -static void +void vfs_free_addrlist(struct netexport *nep) { struct ucred *cred; @@ -285,8 +284,10 @@ vfs_free_addrlist_af(&nep->ne6); cred = nep->ne_defexported.netc_anon; - if (cred != NULL) + if (cred != NULL) { crfree(cred); + nep->ne_defexported.netc_anon = NULL; + } } diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -761,6 +761,10 @@ #endif if (mp->mnt_opt != NULL) vfs_freeopts(mp->mnt_opt); + if (mp->mnt_export != NULL) { + vfs_free_addrlist(mp->mnt_export); + free(mp->mnt_export, M_MOUNT); + } crfree(mp->mnt_cred); uma_zfree(mount_zone, mp); } diff --git a/sys/sys/mount.h b/sys/sys/mount.h --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -1017,6 +1017,7 @@ int vfs_busy(struct mount *, int); int vfs_export /* process mount export info */ (struct mount *, struct export_args *); +void vfs_free_addrlist(struct netexport *); void vfs_allocate_syncvnode(struct mount *); void vfs_deallocate_syncvnode(struct mount *); int vfs_donmount(struct thread *td, uint64_t fsflags,