From: Fredi Raspall Date: Fri, 23 Apr 2021 22:01:41 +0000 (+0200) Subject: isisd: fix memory leak for non-freed spftrees X-Git-Tag: base_8.0~76^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=7c3be15f3e8e554a3ce57eb1a3b69ea349c34f03;p=matthieu%2Ffrr.git isisd: fix memory leak for non-freed spftrees When enabling TI-LFA the forward SPF for neighbors adjacent to the PLR is computed. Later, when computing the PQ spaces, the reverse SPF trees for those adjacent neighbors affected by the protected interface are computed. When node protection is enabled, TI-LFA link protection is run immediately afterwards to compute repairs in case no node-protecting backup path exists. In this second run, the existing code tries to compute the reverse SPF tree for the same node, without freeing the SPF tree of the prior run. This patch fixes this by not computing the reverse SPF again, thus avoiding a memory leak and an unnecessary SPF run. Signed-off-by: Fredi Raspall --- diff --git a/isisd/isis_lfa.c b/isisd/isis_lfa.c index 085177b943..b535924e93 100644 --- a/isisd/isis_lfa.c +++ b/isisd/isis_lfa.c @@ -1148,10 +1148,13 @@ static void lfa_calc_pq_spaces(struct isis_spftree *spftree_pc, /* * Compute the reverse SPF in the behalf of the node - * adjacent to the failure. + * adjacent to the failure, if we haven't done that + * before */ - adj_node->lfa.spftree_reverse = - isis_spf_reverse_run(adj_node->lfa.spftree); + if (!adj_node->lfa.spftree_reverse) + adj_node->lfa.spftree_reverse = + isis_spf_reverse_run( + adj_node->lfa.spftree); lfa_calc_reach_nodes(adj_node->lfa.spftree_reverse, spftree_reverse, adj_nodes, false,