Date: Mon, 29 Jun 2009 18:09:07 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r195166 - head/sys/kern Message-ID: <200906291809.n5TI97rZ051658@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Jun 29 18:09:07 2009 New Revision: 195166 URL: http://svn.freebsd.org/changeset/base/195166 Log: Free struct ucreds allocated in vfs_hang_addrlist() when deleting the export element. While there, remove register storage-class specifiers. Reported and tested by: pho Reviewed by: kan Approved by: re (kensmith) Modified: head/sys/kern/vfs_export.c Modified: head/sys/kern/vfs_export.c ============================================================================== --- head/sys/kern/vfs_export.c Mon Jun 29 17:36:47 2009 (r195165) +++ head/sys/kern/vfs_export.c Mon Jun 29 18:09:07 2009 (r195166) @@ -220,9 +220,13 @@ out: static int vfs_free_netcred(struct radix_node *rn, void *w) { - register struct radix_node_head *rnh = (struct radix_node_head *) w; + struct radix_node_head *rnh = (struct radix_node_head *) w; + struct ucred *cred; (*rnh->rnh_deladdr) (rn->rn_key, rn->rn_mask, rnh); + cred = ((struct netcred *)rn)->netc_anon; + if (cred != NULL) + crfree(cred); free(rn, M_NETADDR); return (0); } @@ -233,10 +237,11 @@ vfs_free_netcred(struct radix_node *rn, static void vfs_free_addrlist(struct netexport *nep) { - register int i; - register struct radix_node_head *rnh; + int i; + struct radix_node_head *rnh; + struct ucred *cred; - for (i = 0; i <= AF_MAX; i++) + for (i = 0; i <= AF_MAX; i++) { if ((rnh = nep->ne_rtable[i])) { RADIX_NODE_HEAD_LOCK(rnh); (*rnh->rnh_walktree) (rnh, vfs_free_netcred, rnh); @@ -245,6 +250,11 @@ vfs_free_addrlist(struct netexport *nep) free(rnh, M_RTABLE); nep->ne_rtable[i] = NULL; /* not SMP safe XXX */ } + } + cred = nep->ne_defexported.netc_anon; + if (cred != NULL) + crfree(cred); + } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906291809.n5TI97rZ051658>