thread_trim_head() already checks that the list is not empty.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
thread_get (struct thread_master *m, u_char type,
int (*func) (struct thread *), void *arg, const char* funcname)
{
- struct thread *thread;
+ struct thread *thread = thread_trim_head (&m->unuse);
- if (!thread_empty (&m->unuse))
+ if (thread)
{
- thread = thread_trim_head (&m->unuse);
if (thread->funcname)
XFREE(MTYPE_THREAD_FUNCNAME, thread->funcname);
}