summaryrefslogtreecommitdiff
path: root/bgpd/bgp_ecommunity.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-11-18 12:50:48 -0500
committerDonald Sharp <sharpd@nvidia.com>2020-11-18 12:50:48 -0500
commit6a37bfb7e50b86df9b5c6cce38c6a86fffb90ed9 (patch)
tree526973b815cf966b6bc567708c246fb2dcdfa014 /bgpd/bgp_ecommunity.c
parentb9d4546253d3d5c55fa45ac07943faaed3ceb253 (diff)
bgpd: Prevent ecommunity_ecom2str memory leak
We were allocating but never freeing memory associated with the ecommunity_ecom2str allocation. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgp_ecommunity.c')
-rw-r--r--bgpd/bgp_ecommunity.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index 74cbf3a80a..43bfb3e2bc 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -903,7 +903,7 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter)
int str_size;
char *str_buf;
- if (ecom->size == 0)
+ if (!ecom || ecom->size == 0)
return XCALLOC(MTYPE_ECOMMUNITY_STR, 1);
/* ecom strlen + space + null term */