diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index d745f8cb78..367398e5fd 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2815,9 +2815,11 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest, /* reap REMOVED routes, if needs be * selected route must stay for a while longer though */ - if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED) - && (pi != old_select)) - bgp_path_info_reap(dest, pi); + if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED) && + (pi != old_select)) { + dest = bgp_path_info_reap(dest, pi); + assert(dest); + } if (debug) zlog_debug(