[quagga-dev 8171] [PATCH] bgpd: fix memory leak when deleting a community

Michael Lambert lambert at psc.edu
Mon Aug 23 17:54:37 BST 2010


* bgp_routemap.c: (route_set_community_delete) When deleting a
  community in a route-map the old community was being orphaned.
---
 bgpd/bgp_routemap.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index aa7dbce..b8da186 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -1484,6 +1484,7 @@ route_set_community_delete (void *rule, struct prefix *prefix,
 	  merge = community_list_match_delete (community_dup (old), list);
 	  new = community_uniq_sort (merge);
 	  community_free (merge);
+	  if (old->refcnt == 0) community_free (old);
 
 	  if (new->size == 0)
 	    {
-- 
1.7.1.1




More information about the Quagga-dev mailing list