Date: Thu, 16 Oct 2014 23:03:05 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r273196 - in releng/10.1/sys: net netpfil/pf Message-ID: <201410162303.s9GN35t0038086@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Thu Oct 16 23:03:04 2014 New Revision: 273196 URL: https://svnweb.freebsd.org/changeset/base/273196 Log: Merge r273184, r273185 from stable/10: - Use rn_detachhead() instead of direct free(9) for radix tables. - Free radix mask entries on main radix destroy. PR: 194078 Approved by: re (gjb) Modified: releng/10.1/sys/net/radix.c releng/10.1/sys/netpfil/pf/pf_table.c Directory Properties: releng/10.1/ (props changed) Modified: releng/10.1/sys/net/radix.c ============================================================================== --- releng/10.1/sys/net/radix.c Thu Oct 16 22:44:30 2014 (r273195) +++ releng/10.1/sys/net/radix.c Thu Oct 16 23:03:04 2014 (r273196) @@ -1204,6 +1204,18 @@ rn_inithead(void **head, int off) return (1); } +static int +rn_freeentry(struct radix_node *rn, void *arg) +{ + struct radix_node_head * const rnh = arg; + struct radix_node *x; + + x = (struct radix_node *)rn_delete(rn + 2, NULL, rnh); + if (x != NULL) + Free(x); + return (0); +} + int rn_detachhead(void **head) { @@ -1214,6 +1226,7 @@ rn_detachhead(void **head) rnh = *head; + rn_walktree(rnh->rnh_masks, rn_freeentry, rnh->rnh_masks); rn_detachhead_internal((void **)&rnh->rnh_masks); rn_detachhead_internal(head); return (1); Modified: releng/10.1/sys/netpfil/pf/pf_table.c ============================================================================== --- releng/10.1/sys/netpfil/pf/pf_table.c Thu Oct 16 22:44:30 2014 (r273195) +++ releng/10.1/sys/netpfil/pf/pf_table.c Thu Oct 16 23:03:04 2014 (r273196) @@ -1854,11 +1854,11 @@ pfr_destroy_ktable(struct pfr_ktable *kt } if (kt->pfrkt_ip4 != NULL) { RADIX_NODE_HEAD_DESTROY(kt->pfrkt_ip4); - free((caddr_t)kt->pfrkt_ip4, M_RTABLE); + rn_detachhead((void **)&kt->pfrkt_ip4); } if (kt->pfrkt_ip6 != NULL) { RADIX_NODE_HEAD_DESTROY(kt->pfrkt_ip6); - free((caddr_t)kt->pfrkt_ip6, M_RTABLE); + rn_detachhead((void **)&kt->pfrkt_ip6); } if (kt->pfrkt_shadow != NULL) pfr_destroy_ktable(kt->pfrkt_shadow, flushaddr);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410162303.s9GN35t0038086>