summaryrefslogtreecommitdiff
path: root/bgpd/bgp_ecommunity.c
diff options
context:
space:
mode:
authorJosh Cox <josh.cox@pureport.com>2020-05-05 13:09:14 -0400
committerJosh Cox <josh.cox@pureport.com>2020-05-05 15:59:38 -0400
commit2c15754ea3327009c9c81650a0fea6f071fd0889 (patch)
treed333a777789177b93d2163778280e02412f8f9e9 /bgpd/bgp_ecommunity.c
parent15e9c561b2a10e90b1370e7a8d43d02ffde9e61a (diff)
bgpd: Check to ensure community attributes exist before freeing them
Community attributes might have been removed by an inbound route map, so we should check to ensure they still exist before trying to free them. This fixes a segfault described in issue #6345. Signed-off-by: Josh Cox <josh.cox@pureport.com>
Diffstat (limited to 'bgpd/bgp_ecommunity.c')
-rw-r--r--bgpd/bgp_ecommunity.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index 062a6477fa..d13da74b04 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -59,6 +59,9 @@ void ecommunity_strfree(char **s)
/* Allocate ecommunities. */
void ecommunity_free(struct ecommunity **ecom)
{
+ if (!(*ecom))
+ return;
+
XFREE(MTYPE_ECOMMUNITY_VAL, (*ecom)->val);
XFREE(MTYPE_ECOMMUNITY_STR, (*ecom)->str);
XFREE(MTYPE_ECOMMUNITY, *ecom);