[MPlayer-cvslog] r30928 - trunk/loader/win32.c
sesse
subversion at mplayerhq.hu
Thu Mar 18 00:42:11 CET 2010
Author: sesse
Date: Thu Mar 18 00:42:11 2010
New Revision: 30928
Log:
Fix thread safety issue in mreq_private: last_alloc was accessed from multiple
threads without being under a mutex.
Modified:
trunk/loader/win32.c
Modified: trunk/loader/win32.c
==============================================================================
--- trunk/loader/win32.c Thu Mar 18 00:38:26 2010 (r30927)
+++ trunk/loader/win32.c Thu Mar 18 00:42:11 2010 (r30928)
@@ -146,7 +146,7 @@ static void longcount_stub(long long*);
static unsigned int (*localcount)()=localcount_stub;
static void (*longcount)(long long*)=longcount_stub;
-static pthread_mutex_t memmut;
+static pthread_mutex_t memmut = PTHREAD_MUTEX_INITIALIZER;
static unsigned int localcount_stub(void)
{
@@ -366,14 +366,9 @@ void* mreq_private(int size, int to_zero
if (to_zero)
memset(header, 0, nsize);
#ifdef GARBAGE
- if (!last_alloc)
- {
- pthread_mutex_init(&memmut, NULL);
- pthread_mutex_lock(&memmut);
- }
- else
+ pthread_mutex_lock(&memmut);
+ if (last_alloc)
{
- pthread_mutex_lock(&memmut);
last_alloc->next = header; /* set next */
}
More information about the MPlayer-cvslog
mailing list