From d8e496242e024f2ce50ef82372e0f34d9d1fac77 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Fri, 30 Jul 2021 16:50:37 +0300 Subject: [PATCH] Revert "bgpd: fix memory leak in dampening" This reverts commit 322e1085fe52540261864bd73a3ecdb37f7203d3. --- bgpd/bgp_damp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index 6d2dc1a65a..dd9de5dc99 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -388,13 +388,16 @@ void bgp_damp_info_free(struct bgp_damp_info *bdi, int withdraw) { assert(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