From 610f23cfff4f323a8a82657ff670187ad714a0fb Mon Sep 17 00:00:00 2001 From: Denil Vira Date: Tue, 11 Aug 2015 11:31:52 -0700 Subject: [PATCH] Fix memory leak in bgpd/bgp_route.c Ticket : CM-7047 Reviewed by : CCR-3321 Testing : Trivial In function bgp_aggregate_add, variables 'aspath' and 'community' are malloced but not guaranteed to be freed before the function returns. --- bgpd/bgp_route.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 9e02b311e7..24ebdaaa6a 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -5741,6 +5741,13 @@ bgp_aggregate_add (struct bgp *bgp, struct prefix *p, afi_t afi, safi_t safi, /* Process change. */ bgp_process (bgp, rn, afi, safi); } + else + { + if (aspath) + aspath_free (aspath); + if (community) + community_free (community); + } } void -- 2.39.5