Skip to content

Commit 2c3d4a5

Browse files
ton31337mergify[bot]
authored andcommitted
bgpd: Fix memory leak when creating BMP connection with a source interface
Testing done with: ``` for x in $(seq 1 100000); do vtysh -c 'conf' -c 'router bgp' -c 'bmp targets test' -c 'bmp connect localhost port 123 min-retry 100 max-retry 100 source-interface lo'; done ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org> (cherry picked from commit 7d19cb5)
1 parent fb3b95b commit 2c3d4a5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bgpd/bgp_bmp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2154,8 +2154,11 @@ DEFPY(bmp_connect,
21542154
}
21552155

21562156
ba = bmp_active_get(bt, hostname, port);
2157-
if (srcif)
2157+
if (srcif) {
2158+
if (ba->ifsrc)
2159+
XFREE(MTYPE_TMP, ba->ifsrc);
21582160
ba->ifsrc = XSTRDUP(MTYPE_TMP, srcif);
2161+
}
21592162
if (min_retry_str)
21602163
ba->minretry = min_retry;
21612164
if (max_retry_str)

0 commit comments

Comments
 (0)