From 8b2e7cacaf6aeba2b377d5da702738a358802f42 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 20 Sep 2017 12:52:38 -0400 Subject: [PATCH] zebra: Free leaked zclient data structures on shutdown On shutdown we were deleting the linked list that kept the zclient connections, but we were not freeing the data pointed at by the link list. This modification allows the normal cleanup of the linked list to cleanup the zclient data structure. Signed-off-by: Donald Sharp --- zebra/zserv.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/zebra/zserv.c b/zebra/zserv.c index e0defa3e3..3c2d8d568 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -2013,8 +2013,8 @@ static void zebra_client_close_cleanup_rnh(struct zserv *client) } } -/* Close zebra client. */ -static void zebra_client_close(struct zserv *client) +/* free zebra client information. */ +static void zebra_client_free(struct zserv *client) { /* Send client de-registration to BFD */ zebra_ptm_bfd_client_deregister(client->proto); @@ -2066,11 +2066,15 @@ static void zebra_client_close(struct zserv *client) vrf_bitmap_free(client->ifinfo); vrf_bitmap_free(client->ridinfo); - /* Free client structure. */ - listnode_delete(zebrad.client_list, client); XFREE(MTYPE_TMP, client); } +static void zebra_client_close(struct zserv *client) +{ + listnode_delete(zebrad.client_list, client); + zebra_client_free(client); +} + /* Make new client. */ static void zebra_client_create(int sock) { @@ -2910,6 +2914,7 @@ void zebra_init(void) { /* Client list init. */ zebrad.client_list = list_new(); + zebrad.client_list->del = (void (*)(void *))zebra_client_free; /* Install configuration write function. */ install_node(&table_node, config_write_table); -- 2.39.5