]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix aspath memleak on error in vnc_direct_bgp_add_nve
authorIgor Ryzhov <iryzhov@nfware.com>
Wed, 9 Feb 2022 22:23:41 +0000 (01:23 +0300)
committermergify-bot <noreply@mergify.com>
Thu, 10 Feb 2022 06:54:08 +0000 (06:54 +0000)
bgp_attr_default_set creates a new empty aspath. If family error happens,
this aspath is not freed. Move attr initialization after we checked the
family.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 606c3f9fb2e164ea3f2fe87b46f99c4be44104bc)

bgpd/rfapi/vnc_export_bgp.c

index 68dc5a4f60cb24eef0f862c44ef6029b40160cd0..534ddcc64bce92098af1464ae666f4b3881a1cac 100644 (file)
@@ -972,9 +972,6 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
 
                        import_table = rfg->rfapi_import_table;
 
-                       bgp_attr_default_set(&attr, BGP_ORIGIN_INCOMPLETE);
-                       /* TBD set some configured med, see add_vnc_route() */
-
                        if (afi == AFI_IP || afi == AFI_IP6) {
                                rt = import_table->imported_vpn[afi];
                        } else {
@@ -983,6 +980,9 @@ void vnc_direct_bgp_add_nve(struct bgp *bgp, struct rfapi_descriptor *rfd)
                                return;
                        }
 
+                       bgp_attr_default_set(&attr, BGP_ORIGIN_INCOMPLETE);
+                       /* TBD set some configured med, see add_vnc_route() */
+
                        /*
                         * Walk the NVE-Group's VNC Import table
                         */