Skip to content

Commit

Permalink
bgpd: Fix memory leak when creating BMP connection with a source inte…
Browse files Browse the repository at this point in the history
…rface

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 <[email protected]>
  • Loading branch information
ton31337 committed Dec 19, 2024
1 parent 6c3e1e4 commit 7d19cb5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bgpd/bgp_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2630,8 +2630,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)
Expand Down

0 comments on commit 7d19cb5

Please sign in to comment.