* bgp_routemap.c: Stop leaking communities.

	Fixes bugzilla #89. [backport candidate]
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog
index 7c33922..2969c32 100644
--- a/bgpd/ChangeLog
+++ b/bgpd/ChangeLog
@@ -1,5 +1,9 @@
 2005-05-27 Hasso Tepper <hasso at quagga.net>
 
+	* bgp_routemap.c: Stop leaking communities.
+
+2005-05-27 Hasso Tepper <hasso at quagga.net>
+
 	* bgpd.c: Deleting bgp->rsclient list needs fix similar to pree-groups
 	  deleting fix. Avoid leaking bgp->group, bgp->peer and bgp->rsclient
 	  lists.
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index fc2c8fd..6c10987 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -1268,6 +1268,10 @@
 	new = community_dup (rcs->com);
 
       attr->community = new;
+
+      if (old)
+	community_free (old);
+
       attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES);
     }
 
@@ -1448,6 +1452,9 @@
 
       bgp_info->attr->ecommunity = new_ecom;
 
+      if (old_ecom)
+	ecommunity_free (old_ecom);
+
       bgp_info->attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_EXT_COMMUNITIES);
     }
   return RMAP_OKAY;