summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2020-05-06 13:36:52 +0200
committerGitHub <noreply@github.com>2020-05-06 13:36:52 +0200
commitd7ed2f10e4ab70f5e534972e088c76bebb571c03 (patch)
tree28f130e29d90a05bfded77956c5ea8ca173d2c76
parente87417f782d562060cd7ea41a32c30d56b17c5ac (diff)
parent5beee2a1ce35f823942f4bf5e41e82be910e4fc2 (diff)
Merge pull request #6353 from ton31337/fix/communities_bgpd_crash_7.3
-rw-r--r--bgpd/bgp_community.c3
-rw-r--r--bgpd/bgp_ecommunity.c3
-rw-r--r--bgpd/bgp_lcommunity.c3
3 files changed, 9 insertions, 0 deletions
diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c
index 432c922ea5..9185eee03a 100644
--- a/bgpd/bgp_community.c
+++ b/bgpd/bgp_community.c
@@ -40,6 +40,9 @@ static struct community *community_new(void)
/* Free communities value. */
void community_free(struct community **com)
{
+ if (!(*com))
+ return;
+
XFREE(MTYPE_COMMUNITY_VAL, (*com)->val);
XFREE(MTYPE_COMMUNITY_STR, (*com)->str);
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index 4c55a0764d..b16a209872 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);
diff --git a/bgpd/bgp_lcommunity.c b/bgpd/bgp_lcommunity.c
index 674686b3c4..e1e2ac97f9 100644
--- a/bgpd/bgp_lcommunity.c
+++ b/bgpd/bgp_lcommunity.c
@@ -44,6 +44,9 @@ static struct lcommunity *lcommunity_new(void)
/* Allocate lcommunities. */
void lcommunity_free(struct lcommunity **lcom)
{
+ if (!(*lcom))
+ return;
+
XFREE(MTYPE_LCOMMUNITY_VAL, (*lcom)->val);
XFREE(MTYPE_LCOMMUNITY_STR, (*lcom)->str);
XFREE(MTYPE_LCOMMUNITY, *lcom);