]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Prevent ecomm memory leak
authorDonald Sharp <sharpd@nvidia.com>
Tue, 27 Oct 2020 19:16:32 +0000 (15:16 -0400)
committerIgor Ryzhov <iryzhov@nfware.com>
Wed, 28 Oct 2020 18:35:48 +0000 (21:35 +0300)
There are some situations where we create a ecommunity for
comparing to internal state when we are deleting, but in the
failure cases we would not free up the created memory.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_evpn_vty.c

index 6369f994a76479fd6dd9fb40b505046f0ef1de45..2f207f8ab807c32b56fa6f95ed90655d2a4a065a 100644 (file)
@@ -5300,6 +5300,7 @@ DEFUN (no_bgp_evpn_vrf_rt,
        if (rt_type == RT_TYPE_IMPORT) {
                if (!bgp_evpn_rt_matches_existing(bgp->vrf_import_rtl,
                                                  ecomdel)) {
+                       ecommunity_free(&ecomdel);
                        vty_out(vty,
                                "%% RT specified does not match configuration for this VRF\n");
                        return CMD_WARNING;
@@ -5308,6 +5309,7 @@ DEFUN (no_bgp_evpn_vrf_rt,
        } else if (rt_type == RT_TYPE_EXPORT) {
                if (!bgp_evpn_rt_matches_existing(bgp->vrf_export_rtl,
                                                  ecomdel)) {
+                       ecommunity_free(&ecomdel);
                        vty_out(vty,
                                "%% RT specified does not match configuration for this VRF\n");
                        return CMD_WARNING;
@@ -5329,12 +5331,14 @@ DEFUN (no_bgp_evpn_vrf_rt,
                }
 
                if (!found_ecomdel) {
+                       ecommunity_free(&ecomdel);
                        vty_out(vty,
                                "%% RT specified does not match configuration for this VRF\n");
                        return CMD_WARNING;
                }
        }
 
+       ecommunity_free(&ecomdel);
        return CMD_SUCCESS;
 }