summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-09-20 18:52:38 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-09-21 15:40:58 +0200
commit972019ae02b5fc6daa3a04790c4687a7399f367c (patch)
treef84e87d97b8d9b5cd2521364ded06b0725e6ced6 /zebra
parentripd: Free leaked memory on shutdown (diff)
downloadfrr-972019ae02b5fc6daa3a04790c4687a7399f367c.tar.xz
frr-972019ae02b5fc6daa3a04790c4687a7399f367c.zip
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>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/zserv.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 55d006a03..2c0e1a020 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);