mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 13:27:53 +00:00
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>
This commit is contained in:
parent
a927c1556d
commit
00fd790f1f
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
DECLARE_MGROUP(STATIC)
|
DECLARE_MGROUP(STATIC)
|
||||||
|
|
||||||
|
DECLARE_MTYPE(STATIC_ROUTE);
|
||||||
DECLARE_MTYPE(STATIC_NEXTHOP);
|
DECLARE_MTYPE(STATIC_NEXTHOP);
|
||||||
DECLARE_MTYPE(STATIC_PATH);
|
DECLARE_MTYPE(STATIC_PATH);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "static_zebra.h"
|
#include "static_zebra.h"
|
||||||
#include "static_debug.h"
|
#include "static_debug.h"
|
||||||
|
|
||||||
DEFINE_MTYPE_STATIC(STATIC, STATIC_ROUTE, "Static Route Info");
|
DEFINE_MTYPE(STATIC, STATIC_ROUTE, "Static Route Info");
|
||||||
DEFINE_MTYPE(STATIC, STATIC_PATH, "Static Path");
|
DEFINE_MTYPE(STATIC, STATIC_PATH, "Static Path");
|
||||||
|
|
||||||
/* Install static path into rib. */
|
/* Install static path into rib. */
|
||||||
|
@ -38,6 +38,10 @@ static void zebra_stable_node_cleanup(struct route_table *table,
|
|||||||
struct static_nexthop *nh;
|
struct static_nexthop *nh;
|
||||||
struct static_path *pn;
|
struct static_path *pn;
|
||||||
struct static_route_info *si;
|
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;
|
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);
|
static_path_list_del(&si->path_list, pn);
|
||||||
XFREE(MTYPE_STATIC_PATH, 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user