bgpd: Free up leaked bpme on release (backport #19629) #19635
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Direct leak of 160 byte(s) in 1 object(s) allocated from:
0 0x7f5b26cb83b7 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
1 0x7f5b2683a34d in qcalloc lib/memory.c:106
2 0x5592a7ec084a in bgp_pbr_match_entry_alloc_intern bgpd/bgp_pbr.c:1097
3 0x7f5b267f9b2f in hash_get lib/hash.c:147
4 0x5592a7ec3654 in bgp_pbr_policyroute_add_to_zebra_unit bgpd/bgp_pbr.c:2467
5 0x5592a7ec643b in bgp_pbr_policyroute_add_to_zebra bgpd/bgp_pbr.c:2608
6 0x5592a7ecd423 in bgp_pbr_handle_entry bgpd/bgp_pbr.c:2813
7 0x5592a7ecd423 in bgp_pbr_update_entry bgpd/bgp_pbr.c:2876
8 0x5592a7fd740a in bgp_zebra_announce_actual bgpd/bgp_zebra.c:1539
9 0x5592a7fdd85d in bgp_handle_route_announcements_to_zebra bgpd/bgp_zebra.c:1810
10 0x7f5b268eecf0 in event_call lib/event.c:2019
11 0x7f5b2681b293 in frr_run lib/libfrr.c:1247
12 0x5592a7dae8b7 in main bgpd/bgp_main.c:557
13 0x7f5b2630c249 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
Turns out that the hash_release of a bpme and not actually freeing it.... is a recipe to leak memory.
This is an automatic backport of pull request #19629 done by Mergify.