From: William King Date: Sun, 19 May 2013 03:42:03 +0000 (-0700) Subject: Theoretical memory leak where if attr_init failed, then check would have still been... X-Git-Tag: v1.2.10~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=898a4874437461e4eb9af2a017ea1bd810e49c24;p=thirdparty%2Ffreeswitch.git Theoretical memory leak where if attr_init failed, then check would have still been malloc'd but not used. --- 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;