diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-12-19 10:56:52 +0200 |
|---|---|---|
| committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2024-12-19 21:57:25 +0000 |
| commit | 2c3d4a5f87d91eb18fae9d83cf57ce930e4be137 (patch) | |
| tree | 0bdb72dc3914644ac9c34d87806c9e6c101f57ed | |
| parent | fb3b95b8b86b59889627665d72ca8d62f8366bcf (diff) | |
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 7d19cb59cf5b129f61f3c568899343b3f031f9b4)
| -rw-r--r-- | bgpd/bgp_bmp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index dbc356bc40..80e0d4d440 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -2154,8 +2154,11 @@ DEFPY(bmp_connect, } ba = bmp_active_get(bt, hostname, port); - if (srcif) + if (srcif) { + if (ba->ifsrc) + XFREE(MTYPE_TMP, ba->ifsrc); ba->ifsrc = XSTRDUP(MTYPE_TMP, srcif); + } if (min_retry_str) ba->minretry = min_retry; if (max_retry_str) |
