Skip to content

Commit

Permalink
Merge pull request #15035 from donaldsharp/more_frr_memory_leaks_on_s…
Browse files Browse the repository at this point in the history
…hutdown

More frr memory leaks on shutdown
  • Loading branch information
ton31337 authored Dec 17, 2023
2 parents a912f8f + e700069 commit e09b5af
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bgpd/bgp_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2884,6 +2884,12 @@ static int bmp_route_update(struct bgp *bgp, afi_t afi, safi_t safi,
return 0;
}

static int bgp_bmp_early_fini(void)
{
resolver_terminate();

return 0;
}

static int bgp_bmp_module_init(void)
{
Expand All @@ -2896,6 +2902,7 @@ static int bgp_bmp_module_init(void)
hook_register(bgp_inst_delete, bmp_bgp_del);
hook_register(frr_late_init, bgp_bmp_init);
hook_register(bgp_route_update, bmp_route_update);
hook_register(frr_early_fini, bgp_bmp_early_fini);
return 0;
}

Expand Down
5 changes: 5 additions & 0 deletions lib/resolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,8 @@ void resolver_init(struct event_loop *tm)
install_element(CONFIG_NODE, &debug_resolver_cmd);
install_element(ENABLE_NODE, &debug_resolver_cmd);
}

void resolver_terminate(void)
{
ares_destroy(state.channel);
}
1 change: 1 addition & 0 deletions lib/resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct resolver_query {
};

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,
const char *hostname,
void (*cb)(struct resolver_query *, const char *, int,
Expand Down
2 changes: 2 additions & 0 deletions nhrpd/nhrp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ static void nhrp_request_stop(void)
nhrp_vc_terminate();

debugf(NHRP_DEBUG_COMMON, "Done.");

resolver_terminate();
frr_fini();

exit(0);
Expand Down
1 change: 1 addition & 0 deletions nhrpd/nhrp_vc.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,5 @@ void nhrp_vc_terminate(void)
{
nhrp_vc_reset();
hash_clean(nhrp_vc_hash, nhrp_vc_free);
hash_free(nhrp_vc_hash);
}

0 comments on commit e09b5af

Please sign in to comment.