summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2016-11-01 21:57:53 +0100
committerRenato Westphal <renato@opensourcerouting.org>2016-11-28 19:15:27 +0100
commit58ac32e2d598b5dc45fa05b7a8a85b107571d697 (patch)
treef55826dc4efaec046bd339e19bcfb13cdf672ae2 /lib
parentbgpd: release all memory explicitly on exit (diff)
downloadfrr-58ac32e2d598b5dc45fa05b7a8a85b107571d697.tar.xz
frr-58ac32e2d598b5dc45fa05b7a8a85b107571d697.zip
zebra/lib: plug several memleaks
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/command.c2
-rw-r--r--lib/qobj.c1
-rw-r--r--lib/table.c4
-rw-r--r--lib/table.h5
4 files changed, 10 insertions, 2 deletions
diff --git a/lib/command.c b/lib/command.c
index e8ba63762..acfcf6857 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -4436,4 +4436,6 @@ cmd_terminate ()
XFREE (MTYPE_HOST, host.motdfile);
if (host.config)
XFREE (MTYPE_HOST, host.config);
+
+ qobj_finish ();
}
diff --git a/lib/qobj.c b/lib/qobj.c
index 65b537f96..f64972e32 100644
--- a/lib/qobj.c
+++ b/lib/qobj.c
@@ -78,6 +78,7 @@ void qobj_init (void)
void qobj_finish (void)
{
+ hash_clean (nodes, NULL);
hash_free (nodes);
nodes = NULL;
}
diff --git a/lib/table.c b/lib/table.c
index d0e084ead..5133ef697 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -494,7 +494,7 @@ route_table_count (const struct route_table *table)
*
* Default function for creating a route node.
*/
-static struct route_node *
+struct route_node *
route_node_create (route_table_delegate_t *delegate,
struct route_table *table)
{
@@ -508,7 +508,7 @@ route_node_create (route_table_delegate_t *delegate,
*
* Default function for destroying a route node.
*/
-static void
+void
route_node_destroy (route_table_delegate_t *delegate,
struct route_table *table, struct route_node *node)
{
diff --git a/lib/table.h b/lib/table.h
index e6cdcfef1..78bf5da74 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -169,6 +169,11 @@ extern struct route_node *route_node_match_ipv6 (const struct route_table *,
extern unsigned long route_table_count (const struct route_table *);
+extern struct route_node *route_node_create (route_table_delegate_t *,
+ struct route_table *);
+extern void route_node_destroy (route_table_delegate_t *,
+ struct route_table *, struct route_node *);
+
extern struct route_node *
route_table_get_next (const struct route_table *table, struct prefix *p);
extern int