Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Oct 2014 21:24:59 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272385 - head/sys/net
Message-ID:  <201410012124.s91LOxFU020608@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: melifaro
Date: Wed Oct  1 21:24:58 2014
New Revision: 272385
URL: https://svnweb.freebsd.org/changeset/base/272385

Log:
  Free radix mask entries on main radix destroy.
  This is temporary commit to be merged to 10.
  Other approach (like hash table) should be used
  to store different masks.
  
  PR:		194078
  Submitted by:	Rumen Telbizov
  MFC after:	3 days

Modified:
  head/sys/net/radix.c

Modified: head/sys/net/radix.c
==============================================================================
--- head/sys/net/radix.c	Wed Oct  1 21:03:17 2014	(r272384)
+++ head/sys/net/radix.c	Wed Oct  1 21:24:58 2014	(r272385)
@@ -1178,6 +1178,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)
 {
@@ -1188,6 +1200,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410012124.s91LOxFU020608>