summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-09-20 12:52:38 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-09-21 09:40:58 -0400
commit972019ae02b5fc6daa3a04790c4687a7399f367c (patch)
treef84e87d97b8d9b5cd2521364ded06b0725e6ced6
parent00c9a53ddc8334e916d64f7f22c092c11ef13531 (diff)
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 <sharpd@cumulusnetworks.com>
-rw-r--r--zebra/zserv.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 55d006a035..2c0e1a0200 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -2104,8 +2104,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);
@@ -2161,11 +2161,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)
{
@@ -3009,6 +3013,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);