From bc9f53f69e8207027bf2b18e3d01b30401e76ace Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 30 Nov 2018 18:08:02 +0100 Subject: bpo-33015: Use malloc() in PyThread_start_new_thread() (GH-10829) The pthread implementation of PyThread_start_new_thread() now uses malloc/free rather than PyMem_Malloc/PyMem_Free, since the latters are not thread-safe. --- Python/thread_pthread.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index ae6b6b6839..6d4b3b389f 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -173,7 +173,7 @@ pythread_wrapper(void *arg) pythread_callback *callback = arg; void (*func)(void *) = callback->func; void *func_arg = callback->arg; - PyMem_Free(arg); + free(arg); func(func_arg); return NULL; @@ -213,7 +213,7 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM); #endif - pythread_callback *callback = PyMem_Malloc(sizeof(pythread_callback)); + pythread_callback *callback = malloc(sizeof(pythread_callback)); if (callback == NULL) { return -1; @@ -235,7 +235,7 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) #endif if (status != 0) { - PyMem_Free(callback); + free(callback); return -1; } -- cgit v1.2.1