diff --git a/libs/esl/src/esl_threadmutex.c b/libs/esl/src/esl_threadmutex.c index 34fa6bb96a..e3706e1274 100644 --- a/libs/esl/src/esl_threadmutex.c +++ b/libs/esl/src/esl_threadmutex.c @@ -148,8 +148,10 @@ ESL_DECLARE(esl_status_t) esl_mutex_create(esl_mutex_t **mutex) #ifdef WIN32 InitializeCriticalSection(&check->mutex); #else - if (pthread_mutexattr_init(&attr)) + if (pthread_mutexattr_init(&attr)) { + free(check); goto done; + } if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE)) goto fail;