mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Use calloc-based functions, not malloc. (GH-19152)
This commit is contained in:
parent
7dd549eb08
commit
7668a8bc93
10 changed files with 17 additions and 38 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue