Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bgpd: Free Memory for SRv6 Functions and Locator Chunks
Implement proper memory cleanup for SRv6 functions and locator chunks to prevent potential memory leaks. The list callback deletion functions have been set. The ASan leak log for reference: ``` *********************************************************************************** Address Sanitizer Error detected in bgp_srv6l3vpn_to_bgp_vrf.test_bgp_srv6l3vpn_to_bgp_vrf/r2.asan.bgpd.4180 ================================================================= ==4180==ERROR: LeakSanitizer: detected memory leaks Direct leak of 544 byte(s) in 2 object(s) allocated from: #0 0x7f8d176a0d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28) sonic-net#1 0x7f8d1709f238 in qcalloc lib/memory.c:105 sonic-net#2 0x55d5dba6ee75 in sid_register bgpd/bgp_mplsvpn.c:591 sonic-net#3 0x55d5dba6ee75 in alloc_new_sid bgpd/bgp_mplsvpn.c:712 sonic-net#4 0x55d5dba6f3ce in ensure_vrf_tovpn_sid_per_af bgpd/bgp_mplsvpn.c:758 sonic-net#5 0x55d5dba6fb94 in ensure_vrf_tovpn_sid bgpd/bgp_mplsvpn.c:849 sonic-net#6 0x55d5dba7f975 in vpn_leak_postchange bgpd/bgp_mplsvpn.h:299 sonic-net#7 0x55d5dba7f975 in vpn_leak_postchange_all bgpd/bgp_mplsvpn.c:3704 sonic-net#8 0x55d5dbbb6c66 in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3164 sonic-net#9 0x7f8d1716f08a in zclient_read lib/zclient.c:4459 sonic-net#10 0x7f8d1713f034 in event_call lib/event.c:1974 sonic-net#11 0x7f8d1708242b in frr_run lib/libfrr.c:1214 sonic-net#12 0x55d5db99d19d in main bgpd/bgp_main.c:510 sonic-net#13 0x7f8d160c5c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86) Direct leak of 296 byte(s) in 1 object(s) allocated from: #0 0x7f8d176a0d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28) sonic-net#1 0x7f8d1709f238 in qcalloc lib/memory.c:105 sonic-net#2 0x7f8d170b1d5f in srv6_locator_chunk_alloc lib/srv6.c:135 sonic-net#3 0x55d5dbbb6a19 in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3144 sonic-net#4 0x7f8d1716f08a in zclient_read lib/zclient.c:4459 sonic-net#5 0x7f8d1713f034 in event_call lib/event.c:1974 sonic-net#6 0x7f8d1708242b in frr_run lib/libfrr.c:1214 sonic-net#7 0x55d5db99d19d in main bgpd/bgp_main.c:510 sonic-net#8 0x7f8d160c5c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86) *********************************************************************************** ``` Signed-off-by: Keelan Cannoo <[email protected]>
- Loading branch information