summaryrefslogtreecommitdiffstats
path: root/eigrpd/eigrp_topology.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-09-24 02:41:49 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-09-24 04:42:26 +0200
commit7eee7ef671b3bb2d2d02940877dde941e6e6fc10 (patch)
tree0beac18e5d533feb52788d33d949a29df2c0b778 /eigrpd/eigrp_topology.c
parentMerge pull request #3071 from donaldsharp/fix_vrf_name (diff)
downloadfrr-7eee7ef671b3bb2d2d02940877dde941e6e6fc10.tar.xz
frr-7eee7ef671b3bb2d2d02940877dde941e6e6fc10.zip
eigrpd: Fix memory leaks and remove dead/unused functions
During shutdown we were not properly cleaning up some memory as reported by valgrind. Additionally during cleanup operations I noticed that there were some dead/unused functions remove/reduce. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'eigrpd/eigrp_topology.c')
-rw-r--r--eigrpd/eigrp_topology.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c
index 80814d6d3..352097273 100644
--- a/eigrpd/eigrp_topology.c
+++ b/eigrpd/eigrp_topology.c
@@ -119,15 +119,8 @@ struct eigrp_nexthop_entry *eigrp_nexthop_entry_new()
*/
void eigrp_topology_free(struct route_table *table)
{
- route_table_finish(table);
-}
-
-/*
- * Deleting all topology nodes in table
- */
-void eigrp_topology_cleanup(struct route_table *table)
-{
eigrp_topology_delete_all(table);
+ route_table_finish(table);
}
/*
@@ -181,6 +174,8 @@ void eigrp_prefix_entry_delete(struct route_table *table,
struct eigrp_prefix_entry *pe)
{
struct eigrp *eigrp = eigrp_lookup();
+ struct eigrp_nexthop_entry *ne;
+ struct listnode *node, *nnode;
struct route_node *rn;
if (!eigrp)
@@ -196,9 +191,12 @@ void eigrp_prefix_entry_delete(struct route_table *table,
*/
listnode_delete(eigrp->topology_changes_internalIPV4, pe);
+ for (ALL_LIST_ELEMENTS(pe->entries, node, nnode, ne))
+ eigrp_nexthop_entry_delete(pe, ne);
list_delete_and_null(&pe->entries);
list_delete_and_null(&pe->rij);
eigrp_zebra_route_delete(pe->destination);
+ prefix_free(pe->destination);
rn->info = NULL;
route_unlock_node(rn); // Lookup above
@@ -237,18 +235,6 @@ void eigrp_topology_delete_all(struct route_table *topology)
}
}
-/*
- * Return 0 if topology is not empty
- * otherwise return 1
- */
-unsigned int eigrp_topology_table_isempty(struct list *topology)
-{
- if (topology->count)
- return 1;
- else
- return 0;
-}
-
struct eigrp_prefix_entry *
eigrp_topology_table_lookup_ipv4(struct route_table *table,
struct prefix *address)