summaryrefslogtreecommitdiffstats
path: root/lib/thread.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2017-07-11 16:08:54 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2017-07-11 16:10:29 +0200
commit151d7c3591f9f6afd0b56700319284979d8f145a (patch)
treedbaeecc1727ff8ca016fda9f45e077baea10b823 /lib/thread.c
parentlib: hash: don't double-init hash list (diff)
downloadfrr-151d7c3591f9f6afd0b56700319284979d8f145a.tar.xz
frr-151d7c3591f9f6afd0b56700319284979d8f145a.zip
lib: drop off "masters" list on master_free()
Don't leave a dangling leaked reference. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/thread.c')
-rw-r--r--lib/thread.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/thread.c b/lib/thread.c
index 4e72d4c96..26fb46e49 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -564,6 +564,12 @@ thread_master_free_unused (struct thread_master *m)
void
thread_master_free (struct thread_master *m)
{
+ pthread_mutex_lock (&masters_mtx);
+ {
+ listnode_delete (masters, m);
+ }
+ pthread_mutex_unlock (&masters_mtx);
+
thread_array_free (m, m->read);
thread_array_free (m, m->write);
thread_queue_free (m, m->timer);