]> git.puffer.fish Git - mirror/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>
Wed, 20 Sep 2017 16:52:38 +0000 (12:52 -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 e0defa3e3621e7605fa61eb469c0e9ce76073763..3c2d8d568b623100a913fe97d97f8850ea5f4564 100644 (file)
@@ -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);