]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Free leaked zclient data structures on shutdown
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 20 Sep 2017 16:52:38 +0000 (12:52 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 21 Sep 2017 13:40:58 +0000 (09:40 -0400)
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>
zebra/zserv.c

index 55d006a035758ab8e9018e9e7e38532c2cb5ece7..2c0e1a020061f67e8aa9ace4938faed5ed071223 100644 (file)
@@ -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);