ospf6d: Cleanup memory on shutdown

some list data structures were never freed

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2023-11-11 22:58:16 -05:00
parent d2aafaf5b6
commit b8fdedc6b8
3 changed files with 16 additions and 0 deletions

View File

@ -103,6 +103,7 @@ static void __attribute__((noreturn)) ospf6_exit(int status)
zclient_free(zclient); zclient_free(zclient);
} }
ospf6_master_delete();
frr_fini(); frr_fini();
exit(status); exit(status);
} }

View File

@ -486,6 +486,7 @@ void ospf6_delete(struct ospf6 *o)
struct ospf6_area *oa; struct ospf6_area *oa;
struct vrf *vrf; struct vrf *vrf;
struct ospf6_external_aggr_rt *aggr; struct ospf6_external_aggr_rt *aggr;
uint32_t i;
QOBJ_UNREG(o); QOBJ_UNREG(o);
@ -532,6 +533,13 @@ void ospf6_delete(struct ospf6 *o)
} }
route_table_finish(o->rt_aggr_tbl); route_table_finish(o->rt_aggr_tbl);
for (i = 0; i <= ZEBRA_ROUTE_MAX; i++) {
if (!o->redist[i])
continue;
list_delete(&o->redist[i]);
}
XFREE(MTYPE_OSPF6_TOP, o->name); XFREE(MTYPE_OSPF6_TOP, o->name);
XFREE(MTYPE_OSPF6_TOP, o); XFREE(MTYPE_OSPF6_TOP, o);
} }
@ -576,6 +584,11 @@ void ospf6_master_init(struct event_loop *master)
om6->master = master; om6->master = master;
} }
void ospf6_master_delete(void)
{
list_delete(&om6->ospf6);
}
static void ospf6_maxage_remover(struct event *thread) static void ospf6_maxage_remover(struct event *thread)
{ {
struct ospf6 *o = (struct ospf6 *)EVENT_ARG(thread); struct ospf6 *o = (struct ospf6 *)EVENT_ARG(thread);

View File

@ -236,6 +236,8 @@ extern struct ospf6_master *om6;
/* prototypes */ /* prototypes */
extern void ospf6_master_init(struct event_loop *master); extern void ospf6_master_init(struct event_loop *master);
extern void ospf6_master_delete(void);
extern void install_element_ospf6_clear_process(void); extern void install_element_ospf6_clear_process(void);
extern void ospf6_top_init(void); extern void ospf6_top_init(void);
extern void ospf6_delete(struct ospf6 *o); extern void ospf6_delete(struct ospf6 *o);