Merge pull request #15035 from donaldsharp/more_frr_memory_leaks_on_shutdown

More frr memory leaks on shutdown
This commit is contained in:
Donatas Abraitis 2023-12-17 12:04:47 +02:00 committed by GitHub
commit e09b5afb9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 0 deletions

View File

@ -2884,6 +2884,12 @@ static int bmp_route_update(struct bgp *bgp, afi_t afi, safi_t safi,
return 0; return 0;
} }
static int bgp_bmp_early_fini(void)
{
resolver_terminate();
return 0;
}
static int bgp_bmp_module_init(void) static int bgp_bmp_module_init(void)
{ {
@ -2896,6 +2902,7 @@ static int bgp_bmp_module_init(void)
hook_register(bgp_inst_delete, bmp_bgp_del); hook_register(bgp_inst_delete, bmp_bgp_del);
hook_register(frr_late_init, bgp_bmp_init); hook_register(frr_late_init, bgp_bmp_init);
hook_register(bgp_route_update, bmp_route_update); hook_register(bgp_route_update, bmp_route_update);
hook_register(frr_early_fini, bgp_bmp_early_fini);
return 0; return 0;
} }

View File

@ -335,3 +335,8 @@ void resolver_init(struct event_loop *tm)
install_element(CONFIG_NODE, &debug_resolver_cmd); install_element(CONFIG_NODE, &debug_resolver_cmd);
install_element(ENABLE_NODE, &debug_resolver_cmd); install_element(ENABLE_NODE, &debug_resolver_cmd);
} }
void resolver_terminate(void)
{
ares_destroy(state.channel);
}

View File

@ -23,6 +23,7 @@ struct resolver_query {
}; };
void resolver_init(struct event_loop *tm); void resolver_init(struct event_loop *tm);
void resolver_terminate(void);
void resolver_resolve(struct resolver_query *query, int af, vrf_id_t vrf_id, void resolver_resolve(struct resolver_query *query, int af, vrf_id_t vrf_id,
const char *hostname, const char *hostname,
void (*cb)(struct resolver_query *, const char *, int, void (*cb)(struct resolver_query *, const char *, int,

View File

@ -92,6 +92,8 @@ static void nhrp_request_stop(void)
nhrp_vc_terminate(); nhrp_vc_terminate();
debugf(NHRP_DEBUG_COMMON, "Done."); debugf(NHRP_DEBUG_COMMON, "Done.");
resolver_terminate();
frr_fini(); frr_fini();
exit(0); exit(0);

View File

@ -214,4 +214,5 @@ void nhrp_vc_terminate(void)
{ {
nhrp_vc_reset(); nhrp_vc_reset();
hash_clean(nhrp_vc_hash, nhrp_vc_free); hash_clean(nhrp_vc_hash, nhrp_vc_free);
hash_free(nhrp_vc_hash);
} }