summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorMichael Lambert <lambert@psc.edu>2010-09-13 11:48:11 -0400
committerPaul Jakma <paul@quagga.net>2011-04-01 15:58:39 +0100
commit604a9b43dd68a087ca5a4ac2cae19eb17591ba5f (patch)
tree060a9bc1987cb04cc530c91923367ab5498dd914 /bgpd
parent4a2035fd71990848017237838fe11bc1aeb41641 (diff)
bgpd: fix memory leak when deleting a community
* 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.
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_routemap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 81ff48db..255b25ae 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -1393,6 +1393,13 @@ route_set_community_delete (void *rule, struct prefix *prefix,
new = community_uniq_sort (merge);
community_free (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;