Skip to content

Commit

Permalink
bgpd: fix as_pretty mem leaks when un-hiding
Browse files Browse the repository at this point in the history
Upon reconfiguration of the default instance, free the previous pointer.

> =================================================================
> ==1209420==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 4 byte(s) in 1 object(s) allocated from:
>     #0 0x7fbde0eaa037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
>     #1 0x7fbde0874634 in qcalloc lib/memory.c:106
>     #2 0x55dcca019263 in bgp_rtc_plist_entry_asn_new bgpd/bgp_rtc.c:474
>     #3 0x55dcca0199f6 in bgp_rtc_plist_entry_add bgpd/bgp_rtc.c:556
>     #4 0x55dcca01b078 in bgp_rtc_plist_entry_set bgpd/bgp_rtc.c:700
>     #5 0x55dcca016421 in bgp_nlri_parse_rtc bgpd/bgp_rtc.c:56
>     #6 0x55dcc9f39f61 in bgp_nlri_parse bgpd/bgp_packet.c:352
>     #7 0x55dcc9f47628 in bgp_update_receive bgpd/bgp_packet.c:2485
>     #8 0x55dcc9f54867 in bgp_process_packet bgpd/bgp_packet.c:4114
>     #9 0x7fbde097aebc in event_call lib/event.c:1984
>     #10 0x7fbde084710f in frr_run lib/libfrr.c:1246
>     #11 0x55dcc9dd818b in main bgpd/bgp_main.c:557
>     #12 0x7fbde044fd79 in __libc_start_main ../csu/libc-start.c:308

Fixes: 4d0e7a4 ("bgpd: VRF-Lite fix default bgp delete")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
  • Loading branch information
louis-6wind committed Feb 12, 2025
1 parent 3961764 commit 4ea376f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bgpd/bgpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3462,6 +3462,8 @@ static struct bgp *bgp_create(as_t *as, const char *name,

peer_init:
bgp->as = *as;
if (hidden)
XFREE(MTYPE_BGP_NAME, bgp->as_pretty);
if (as_pretty)
bgp->as_pretty = XSTRDUP(MTYPE_BGP_NAME, as_pretty);
else
Expand Down

0 comments on commit 4ea376f

Please sign in to comment.