summaryrefslogtreecommitdiffstats
path: root/staticd/static_vrf.c
diff options
context:
space:
mode:
authorvdhingra <vdhingra@vmware.com>2020-10-23 14:09:24 +0200
committervdhingra <vdhingra@vmware.com>2020-10-30 13:22:36 +0100
commit00fd790f1f1ae7f40037749eba24d1211426a244 (patch)
tree26fffe8c9115d45e8fe79813f993c77d7e43ebd3 /staticd/static_vrf.c
parentMerge pull request #7372 from mjstapp/fix_ntoa_ripd (diff)
downloadfrr-00fd790f1f1ae7f40037749eba24d1211426a244.tar.xz
frr-00fd790f1f1ae7f40037749eba24d1211426a244.zip
staticd: fixed memory leak on shudown
When shutdown triggered, info pointer pointing to static_route_info was not getting released for route_table and srcdest_table. Signed-off-by: vishaldhingra <vdhingra@vmware.com>
Diffstat (limited to 'staticd/static_vrf.c')
-rw-r--r--staticd/static_vrf.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/staticd/static_vrf.c b/staticd/static_vrf.c
index 39b86787f..5ae342571 100644
--- a/staticd/static_vrf.c
+++ b/staticd/static_vrf.c
@@ -38,6 +38,10 @@ static void zebra_stable_node_cleanup(struct route_table *table,
struct static_nexthop *nh;
struct static_path *pn;
struct static_route_info *si;
+ struct route_table *src_table;
+ struct route_node *src_node;
+ struct static_path *src_pn;
+ struct static_route_info *src_si;
si = node->info;
@@ -51,6 +55,37 @@ static void zebra_stable_node_cleanup(struct route_table *table,
static_path_list_del(&si->path_list, pn);
XFREE(MTYPE_STATIC_PATH, pn);
}
+
+ /* clean up for dst table */
+ src_table = srcdest_srcnode_table(node);
+ if (src_table) {
+ /* This means the route_node is part of the top
+ * hierarchy and refers to a destination prefix.
+ */
+ for (src_node = route_top(src_table); src_node;
+ src_node = route_next(src_node)) {
+ src_si = src_node->info;
+
+ frr_each_safe(static_path_list,
+ &src_si->path_list, src_pn) {
+ frr_each_safe(static_nexthop_list,
+ &src_pn->nexthop_list,
+ nh) {
+ static_nexthop_list_del(
+ &src_pn->nexthop_list,
+ nh);
+ XFREE(MTYPE_STATIC_NEXTHOP, nh);
+ }
+ static_path_list_del(&src_si->path_list,
+ src_pn);
+ XFREE(MTYPE_STATIC_PATH, src_pn);
+ }
+
+ XFREE(MTYPE_STATIC_ROUTE, src_node->info);
+ }
+ }
+
+ XFREE(MTYPE_STATIC_ROUTE, node->info);
}
}