From: Victor Julien Date: Fri, 16 Jan 2015 10:06:35 +0000 (+0100) Subject: threads: fix missing unlock in error handling X-Git-Tag: suricata-3.0RC1~442 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2f85308afe216e399a164018d375932dca57093b;p=thirdparty%2Fsuricata.git 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() --- diff --git a/src/tm-threads.c b/src/tm-threads.c index b7fb3a6957..92f35e5178 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -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;