Ensuring mutex is unlocked on destroy.

This commit is contained in:
Armin Novak 2015-04-28 09:42:46 +02:00
parent ac15ce2da8
commit fe27913859

View File

@ -67,9 +67,9 @@ BOOL MutexCloseHandle(HANDLE handle)
if (!MutexIsHandled(handle))
return FALSE;
#if defined(WITH_DEBUG_MUTEX)
if (pthread_mutex_trylock(&mutex->mutex))
{
#if defined(WITH_DEBUG_MUTEX)
size_t used = 0, i;
void* stack = winpr_backtrace(20);
char **msg = NULL;
@ -84,10 +84,11 @@ BOOL MutexCloseHandle(HANDLE handle)
}
free (msg);
winpr_backtrace_free(stack);
}
else
pthread_mutex_unlock(&mutex->mutex);
#endif
}
if (pthread_mutex_unlock(&mutex->mutex))
return FALSE;
if (!pthread_mutex_destroy(&mutex->mutex))
return FALSE;