@@ -282,14 +282,14 @@ PyThread_allocate_lock(void)
282282 if (!initialized )
283283 PyThread_init_thread ();
284284
285- lock = (sem_t * )malloc (sizeof (sem_t ));
285+ lock = (sem_t * )PyMem_RawMalloc (sizeof (sem_t ));
286286
287287 if (lock ) {
288288 status = sem_init (lock ,0 ,1 );
289289 CHECK_STATUS ("sem_init" );
290290
291291 if (error ) {
292- free ((void * )lock );
292+ PyMem_RawFree ((void * )lock );
293293 lock = NULL ;
294294 }
295295 }
@@ -313,7 +313,7 @@ PyThread_free_lock(PyThread_type_lock lock)
313313 status = sem_destroy (thelock );
314314 CHECK_STATUS ("sem_destroy" );
315315
316- free ((void * )thelock );
316+ PyMem_RawFree ((void * )thelock );
317317}
318318
319319/*
@@ -410,7 +410,7 @@ PyThread_allocate_lock(void)
410410 if (!initialized )
411411 PyThread_init_thread ();
412412
413- lock = (pthread_lock * ) malloc (sizeof (pthread_lock ));
413+ lock = (pthread_lock * ) PyMem_RawMalloc (sizeof (pthread_lock ));
414414 if (lock ) {
415415 memset ((void * )lock , '\0' , sizeof (pthread_lock ));
416416 lock -> locked = 0 ;
@@ -430,7 +430,7 @@ PyThread_allocate_lock(void)
430430 CHECK_STATUS ("pthread_cond_init" );
431431
432432 if (error ) {
433- free ((void * )lock );
433+ PyMem_RawFree ((void * )lock );
434434 lock = 0 ;
435435 }
436436 }
@@ -457,7 +457,7 @@ PyThread_free_lock(PyThread_type_lock lock)
457457 status = pthread_mutex_destroy ( & thelock -> mut );
458458 CHECK_STATUS ("pthread_mutex_destroy" );
459459
460- free ((void * )thelock );
460+ PyMem_RawFree ((void * )thelock );
461461}
462462
463463PyLockStatus
0 commit comments