From: Donald Sharp Date: Sat, 29 Mar 2025 16:02:11 +0000 (-0400) Subject: bgpd: Free memory associated with aspath_dup X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=354aee89325f256fe92ff3af33f41da2a56ec2a1;p=matthieu%2Ffrr.git bgpd: Free memory associated with aspath_dup Fix this: ==3890443== 92 (48 direct, 44 indirect) bytes in 1 blocks are definitely lost in loss record 68 of 98 ==3890443== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==3890443== by 0x49737B3: qcalloc (memory.c:106) ==3890443== by 0x3EA63B: aspath_dup (bgp_aspath.c:703) ==3890443== by 0x2F5438: route_set_aspath_exclude (bgp_routemap.c:2604) ==3890443== by 0x49BC52A: route_map_apply_ext (routemap.c:2708) ==3890443== by 0x2C1069: bgp_input_modifier (bgp_route.c:1925) ==3890443== by 0x2C9F12: bgp_update (bgp_route.c:5205) ==3890443== by 0x2CF281: bgp_nlri_parse_ip (bgp_route.c:7271) ==3890443== by 0x2A28C7: bgp_nlri_parse (bgp_packet.c:338) ==3890443== by 0x2A7F5C: bgp_update_receive (bgp_packet.c:2448) ==3890443== by 0x2ACCA6: bgp_process_packet (bgp_packet.c:4046) ==3890443== by 0x49EB77C: event_call (event.c:2019) ==3890443== by 0x495FAD1: frr_run (libfrr.c:1247) ==3890443== by 0x208D6D: main (bgp_main.c:557) Signed-off-by: Donald Sharp --- diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index c7c8f157ca..15ad921ad0 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -2615,6 +2615,9 @@ route_set_aspath_exclude(void *rule, const struct prefix *dummy, void *object) path->attr->aspath = aspath_filter_exclude_acl(new_path, ase->exclude_aspath_acl); + else + aspath_free(new_path); + return RMAP_OKAY; }