summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrgirada <rgirada@vmware.com>2021-04-06 05:40:31 -0700
committerrgirada <rgirada@vmware.com>2021-04-16 11:15:53 -0700
commit4a61b0d00ef4f398e994cd632386c5a51e322f2f (patch)
tree57f2408f71ebc6d8d29a426b1818b0a80ba5654f
parent4af86fb679b1ab8dad016bb0d49cd48d4d4eee94 (diff)
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 <rgirada@vmware.com>
-rw-r--r--ospfd/ospf_asbr.c29
1 files changed, 19 insertions, 10 deletions
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 */