summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-11-30 18:08:02 +0100
committerGitHub <noreply@github.com>2018-11-30 18:08:02 +0100
commitbc9f53f69e8207027bf2b18e3d01b30401e76ace (patch)
tree1c8892446fca4e94e285349b3f6314ace6c29b75
parent8f83c2fb19c45350c2161d9e75dab4cd2bcaee28 (diff)
downloadcpython-git-bc9f53f69e8207027bf2b18e3d01b30401e76ace.tar.gz
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.
-rw-r--r--Python/thread_pthread.h6
1 files 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;
}