diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-07 15:17:59 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-07 15:17:59 (GMT) |
commit | 80aa565fb4a4be45ea7b94487bd10f1ab0ff5410 (patch) | |
tree | 057d5543ba9811184797993a17eb38d09a4926d8 /Python/thread_nt.h | |
parent | b7f1f65f1c1c0b80e613f5fbf3a4ed3e3e2c72f9 (diff) | |
download | cpython-80aa565fb4a4be45ea7b94487bd10f1ab0ff5410.zip cpython-80aa565fb4a4be45ea7b94487bd10f1ab0ff5410.tar.gz cpython-80aa565fb4a4be45ea7b94487bd10f1ab0ff5410.tar.bz2 |
Issue #18203: Replace malloc() with PyMem_RawMalloc() to allocate thread locks
Diffstat (limited to 'Python/thread_nt.h')
-rw-r--r-- | Python/thread_nt.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/thread_nt.h b/Python/thread_nt.h index bd604fb..ab5a081 100644 --- a/Python/thread_nt.h +++ b/Python/thread_nt.h @@ -34,7 +34,7 @@ typedef NRMUTEX *PNRMUTEX; 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 @@ AllocNonRecursiveMutex() m->locked = 0; return m; fail: - free(m); + PyMem_RawFree(m); return NULL; } @@ -56,7 +56,7 @@ FreeNonRecursiveMutex(PNRMUTEX mutex) if (mutex) { PyCOND_FINI(&mutex->cv); PyMUTEX_FINI(&mutex->cs); - free(mutex); + PyMem_RawFree(mutex); } } @@ -107,7 +107,7 @@ LeaveNonRecursiveMutex(PNRMUTEX mutex) result = PyCOND_SIGNAL(&mutex->cv); result &= PyMUTEX_UNLOCK(&mutex->cs); return result; -} +} #else /* if ! _PY_USE_CV_LOCKS */ |