Mercurial > cpython-lru_cache-weakref
diff Python/thread_nt.h @ 84497:9af1905f20af
Issue #18203: Replace malloc() with PyMem_RawMalloc() to allocate thread locks
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Sun, 07 Jul 2013 17:17:59 +0200 |
| parents | b71b6517af63 |
| children |
line wrap: on
line diff
--- a/Python/thread_nt.h Sun Jul 07 17:10:34 2013 +0200 +++ b/Python/thread_nt.h Sun Jul 07 17:17:59 2013 +0200 @@ -34,7 +34,7 @@ PNRMUTEX AllocNonRecursiveMutex() { - PNRMUTEX m = (PNRMUTEX)malloc(sizeof(NRMUTEX)); + PNRMUTEX m = (PNRMUTEX)PyMem_RawMalloc(sizeof(NRMUTEX)); if (!m) return NULL; if (PyCOND_INIT(&m->cv)) @@ -46,7 +46,7 @@ m->locked = 0; return m; fail: - free(m); + PyMem_RawFree(m); return NULL; } @@ -56,7 +56,7 @@ if (mutex) { PyCOND_FINI(&mutex->cv); PyMUTEX_FINI(&mutex->cs); - free(mutex); + PyMem_RawFree(mutex); } } @@ -107,7 +107,7 @@ result = PyCOND_SIGNAL(&mutex->cv); result &= PyMUTEX_UNLOCK(&mutex->cs); return result; -} +} #else /* if ! _PY_USE_CV_LOCKS */
