Merge pull request #3433 from matt335672/coverity_scan

Address Coverity mutex issues
This commit is contained in:
matt335672
2025-02-14 17:09:53 +00:00
committed by GitHub
+10 -3
View File
@@ -33,6 +33,7 @@
#include <semaphore.h> #include <semaphore.h>
#endif #endif
#include "arch.h" #include "arch.h"
#include "log.h"
#include "thread_calls.h" #include "thread_calls.h"
#include "os_calls.h" #include "os_calls.h"
@@ -136,11 +137,17 @@ tc_mutex_lock(tbus mutex)
{ {
#if defined(_WIN32) #if defined(_WIN32)
WaitForSingleObject((HANDLE)mutex, INFINITE); WaitForSingleObject((HANDLE)mutex, INFINITE);
return 0;
#else #else
pthread_mutex_lock((pthread_mutex_t *)mutex); if (mutex != 0)
return 0; {
pthread_mutex_lock((pthread_mutex_t *)mutex);
}
else
{
LOG(LOG_LEVEL_ERROR, "Attempt made to lock NULL mutex");
}
#endif #endif
return 0;
} }
/*****************************************************************************/ /*****************************************************************************/