summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_evpn_vty.c
diff options
context:
space:
mode:
authoranlan_cs <vic.lan@pica8.com>2022-11-01 03:09:15 +0100
committeranlan_cs <vic.lan@pica8.com>2022-11-03 14:21:14 +0100
commited8862ad30a57f7abb99e8cf6cdf6b3fab4d9cfb (patch)
tree3e90641a731dab625339153f6da6791cc6acb7d3 /bgpd/bgp_evpn_vty.c
parentMerge pull request #12114 from opensourcerouting/feature/bgp_aigp_attribute (diff)
downloadfrr-ed8862ad30a57f7abb99e8cf6cdf6b3fab4d9cfb.tar.xz
frr-ed8862ad30a57f7abb99e8cf6cdf6b3fab4d9cfb.zip
bgpd: avoid possible memleak
In the case of without ':' in `ecom_str`, memleak on this `ecom_str` will occur. Just free `ecom_str` for this case. Signed-off-by: anlan_cs <vic.lan@pica8.com>
Diffstat (limited to 'bgpd/bgp_evpn_vty.c')
-rw-r--r--bgpd/bgp_evpn_vty.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index c0ad72dc3..7dbfdc60d 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -6639,9 +6639,10 @@ void bgp_config_write_evpn_info(struct vty *vty, struct bgp *bgp, afi_t afi,
char *vni_str = NULL;
vni_str = strchr(ecom_str, ':');
-
- if (!vni_str)
- continue; /* This should never happen */
+ if (!vni_str) {
+ XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+ continue;
+ }
/* Move pointer to vni */
vni_str += 1;