[quagga-dev 8261] [PATCH] bgpd: fix memory leak when deleting a community
lambert at psc.edu
Mon Sep 13 16:48:11 BST 2010
* bgp_routemap.c: (route_set_community_delete) When deleting a
community in a route-map the old community was being orphaned. Like
the description of the same code in route_set_community, this is a
hack, not a true fix.
bgpd/bgp_routemap.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index aa7dbce..4ba6f9b 100644
@@ -1485,6 +1485,13 @@ route_set_community_delete (void *rule, struct prefix *prefix,
new = community_uniq_sort (merge);
+ /* HACK: if the old community is not intern'd,
+ * we should free it here, or all reference to it may be lost.
+ * Really need to cleanup attribute caching sometime.
+ if (old->refcnt == 0)
+ community_free (old);
if (new->size == 0)
binfo->attr->community = NULL;
More information about the Quagga-dev