From 322e1085fe52540261864bd73a3ecdb37f7203d3 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Thu, 29 Jul 2021 01:27:18 +0300 Subject: [PATCH] bgpd: fix memory leak in dampening bdi->path is never NULL, therefore the structure was never freed. Signed-off-by: Igor Ryzhov --- bgpd/bgp_damp.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index bf61d73588..f2090279c9 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -390,16 +390,13 @@ void bgp_damp_info_free(struct bgp_damp_info *bdi, struct bgp_damp_config *bdc, { assert(bdc && bdi); - if (bdi->path == NULL) { - XFREE(MTYPE_BGP_DAMP_INFO, bdi); - return; - } - bdi->path->extra->damp_info = NULL; bgp_path_info_unset_flag(bdi->dest, bdi->path, BGP_PATH_HISTORY | BGP_PATH_DAMPED); if (bdi->lastrecord == BGP_RECORD_WITHDRAW && withdraw) bgp_path_info_delete(bdi->dest, bdi->path); + + XFREE(MTYPE_BGP_DAMP_INFO, bdi); } static void bgp_damp_parameter_set(int hlife, int reuse, int sup, int maxsup, -- 2.39.5