From 898a4874437461e4eb9af2a017ea1bd810e49c24 Mon Sep 17 00:00:00 2001 From: William King Date: Sat, 18 May 2013 20:42:03 -0700 Subject: [PATCH] Theoretical memory leak where if attr_init failed, then check would have still been malloc'd but not used. --- libs/esl/src/esl_threadmutex.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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;