From: rgirada Date: Tue, 6 Apr 2021 12:40:31 +0000 (-0700) Subject: ospfd: Fixing few valgrind issues X-Git-Tag: base_8.0~84^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F8409%2Fhead;p=mirror%2Ffrr.git ospfd: Fixing few valgrind issues Description: All matching external routes are added to matching external hash table of aggregate route when aggregation is enabled. But these external info pointers are not delinked from this hash table before freeing the corresponding memory while disabling redistribution. Addressing these memory issues in this change. Signed-off-by: Rajesh Girada --- diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c index 0b4e5d7762..1faf6bfc12 100644 --- a/ospfd/ospf_asbr.c +++ b/ospfd/ospf_asbr.c @@ -314,20 +314,29 @@ void ospf_redistribute_withdraw(struct ospf *ospf, uint8_t type, if (EXTERNAL_INFO(ext)) for (rn = route_top(EXTERNAL_INFO(ext)); rn; rn = route_next(rn)) - if ((ei = rn->info)) - if (ospf_external_info_find_lsa(ospf, &ei->p)) { - if (is_prefix_default(&ei->p) - && ospf->default_originate - != DEFAULT_ORIGINATE_NONE) - continue; + if ((ei = rn->info)) { + struct ospf_external_aggr_rt *aggr; + + if (is_prefix_default(&ei->p) + && ospf->default_originate + != DEFAULT_ORIGINATE_NONE) + continue; + + aggr = ei->aggr_route; + + if (aggr) + ospf_unlink_ei_from_aggr(ospf, aggr, + ei); + else if (ospf_external_info_find_lsa(ospf, + &ei->p)) ospf_external_lsa_flush( ospf, type, &ei->p, ei->ifindex /*, ei->nexthop */); - ospf_external_info_free(ei); - route_unlock_node(rn); - rn->info = NULL; - } + ospf_external_info_free(ei); + route_unlock_node(rn); + rn->info = NULL; + } } /* External Route Aggregator Handlers */