Theoretical memory leak where if attr_init failed, then check would have still been malloc'd but not used.

This commit is contained in:
William King 2013-05-18 20:42:03 -07:00
parent e2ea6e58c8
commit b4209ca93b
1 changed files with 3 additions and 1 deletions

View File

@ -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;