threads: fix missing unlock in error handling

If TmThreadsUnregisterThread was called with out of range 'id', a lock
would not be cleared after returning from the function.

** CID 1264421:  Missing unlock  (LOCK)
/src/tm-threads.c: 2186 in TmThreadsUnregisterThread()
pull/1478/head
Victor Julien 11 years ago
parent 0e2a4c01ba
commit 2f85308afe

@ -2112,8 +2112,10 @@ int TmThreadsRegisterThread(ThreadVars *tv, const int type)
void TmThreadsUnregisterThread(const int id)
{
SCMutexLock(&thread_store_lock);
if (id <= 0 || id > (int)thread_store.threads_size)
if (id <= 0 || id > (int)thread_store.threads_size) {
SCMutexUnlock(&thread_store_lock);
return;
}
/* id is one higher than index */
int idx = id - 1;

Loading…
Cancel
Save