From: Donatas Abraitis Date: Fri, 9 Sep 2022 20:26:50 +0000 (+0300) Subject: bgpd: Fix memory leak for `set as-path replace` route-map command X-Git-Tag: base_8.4~51^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=67a9da92a1836a397456f8e8e0f9a9eee9dd4715;p=mirror%2Ffrr.git bgpd: Fix memory leak for `set as-path replace` route-map command ==1174993== 252 (120 direct, 132 indirect) bytes in 3 blocks are definitely lost in loss record 77 of 100 ==1174993== at 0x483AB65: calloc (vg_replace_malloc.c:760) ==1174993== by 0x493C8D5: qcalloc (memory.c:116) ==1174993== by 0x378E38: aspath_dup (bgp_aspath.c:698) ==1174993== by 0x2A39E2: route_set_aspath_replace (bgp_routemap.c:2259) ==1174993== by 0x4965C71: route_map_apply_ext (routemap.c:2664) ==1174993== by 0x27BCC8: bgp_input_modifier (bgp_route.c:1657) ==1174993== by 0x281AB9: bgp_update (bgp_route.c:3992) ==1174993== by 0x286368: bgp_nlri_parse_ip (bgp_route.c:5890) ==1174993== by 0x264D20: bgp_nlri_parse (bgp_packet.c:347) ==1174993== by 0x2682FE: bgp_update_receive (bgp_packet.c:1921) ==1174993== by 0x26AA67: bgp_process_packet (bgp_packet.c:2822) ==1174993== by 0x498F5FD: thread_call (thread.c:2008) ==1174993== by 0x49253DA: frr_run (libfrr.c:1198) ==1174993== by 0x1EEC38: main (bgp_main.c:520) Signed-off-by: Donatas Abraitis --- diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 40bbdccff4..70be458c78 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -2270,6 +2270,8 @@ route_set_aspath_replace(void *rule, const struct prefix *dummy, void *object) aspath_new, replace_asn, own_asn); } + aspath_free(aspath_new); + return RMAP_OKAY; }