summaryrefslogtreecommitdiffstats
path: root/Modules/_ssl.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-07 14:21:41 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-07 14:21:41 (GMT)
commitb64049183cee61edc112eefa3ca76916d03e9f02 (patch)
treefd0be14ac288739314a5108c6e21879f641b0b40 /Modules/_ssl.c
parent1a7425f67a0d141483d89ca80ca01e3cb7f6be92 (diff)
downloadcpython-b64049183cee61edc112eefa3ca76916d03e9f02.zip
cpython-b64049183cee61edc112eefa3ca76916d03e9f02.tar.gz
cpython-b64049183cee61edc112eefa3ca76916d03e9f02.tar.bz2
Issue #18203: Replace malloc() with PyMem_Malloc() in Python modules
Replace malloc() with PyMem_Malloc() when the GIL is held, or with PyMem_RawMalloc() otherwise.
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r--Modules/_ssl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 1d7ddcb..ff3ef9e 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -3118,7 +3118,7 @@ static int _setup_ssl_threads(void) {
if (_ssl_locks == NULL) {
_ssl_locks_count = CRYPTO_num_locks();
_ssl_locks = (PyThread_type_lock *)
- malloc(sizeof(PyThread_type_lock) * _ssl_locks_count);
+ PyMem_Malloc(sizeof(PyThread_type_lock) * _ssl_locks_count);
if (_ssl_locks == NULL)
return 0;
memset(_ssl_locks, 0,
@@ -3130,7 +3130,7 @@ static int _setup_ssl_threads(void) {
for (j = 0; j < i; j++) {
PyThread_free_lock(_ssl_locks[j]);
}
- free(_ssl_locks);
+ PyMem_Free(_ssl_locks);
return 0;
}
}