Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address Coverity mutex issues #3433

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions common/thread_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <semaphore.h>
#endif
#include "arch.h"
#include "log.h"
#include "thread_calls.h"
#include "os_calls.h"

Expand Down Expand Up @@ -136,11 +137,17 @@ tc_mutex_lock(tbus mutex)
{
#if defined(_WIN32)
WaitForSingleObject((HANDLE)mutex, INFINITE);
return 0;
#else
pthread_mutex_lock((pthread_mutex_t *)mutex);
return 0;
if (mutex != 0)
{
pthread_mutex_lock((pthread_mutex_t *)mutex);
}
else
{
LOG(LOG_LEVEL_ERROR, "Attempt made to lock NULL mutex");
}
#endif
return 0;
}

/*****************************************************************************/
Expand Down
Loading