From 3376972e5ec7626b75a82a6d82fdc904ad010144 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 25 Feb 2023 07:43:30 -0500 Subject: [PATCH] bgpd: Prevent asn dot memory leak When allocating a new bit of memory free the old first. Signed-off-by: Donald Sharp --- bgpd/bgpd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index f97004dc12..96c6a111ce 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -6313,8 +6313,11 @@ int peer_local_as_set(struct peer *peer, as_t as, bool no_prepend, && old_replace_as == replace_as) return 0; peer->change_local_as = as; - if (as_str) + if (as_str) { + if (peer->change_local_as_pretty) + XFREE(MTYPE_BGP, peer->change_local_as_pretty); peer->change_local_as_pretty = XSTRDUP(MTYPE_BGP, as_str); + } (void)peer_sort(peer); -- 2.39.5