Use calloc-based functions, not malloc. (GH-19152)

This commit is contained in:
Andy Lester
2020-03-24 23:26:44 -05:00
committed by GitHub
parent 7dd549eb08
commit 7668a8bc93
10 changed files with 17 additions and 38 deletions

View File

@@ -547,9 +547,8 @@ PyThread_allocate_lock(void)
if (!initialized)
PyThread_init_thread();
lock = (pthread_lock *) PyMem_RawMalloc(sizeof(pthread_lock));
lock = (pthread_lock *) PyMem_RawCalloc(1, sizeof(pthread_lock));
if (lock) {
memset((void *)lock, '\0', sizeof(pthread_lock));
lock->locked = 0;
status = pthread_mutex_init(&lock->mut, NULL);