diff options
author | Christian Heimes <christian@python.org> | 2016-09-13 18:48:13 (GMT) |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2016-09-13 18:48:13 (GMT) |
commit | f6365e381620d95a112720d9f18ab6137882ecca (patch) | |
tree | 71c7d78552ff49e7e3033ce01bd8a995f404c306 /Modules/_ssl.c | |
parent | f051e43b22af014364e231c36489e6745993ea34 (diff) | |
download | cpython-f6365e381620d95a112720d9f18ab6137882ecca.zip cpython-f6365e381620d95a112720d9f18ab6137882ecca.tar.gz cpython-f6365e381620d95a112720d9f18ab6137882ecca.tar.bz2 |
Issue #28188: Use PyMem_Calloc() to get rid of a type-limits warning and an extra memset() call in _ssl.c.
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r-- | Modules/_ssl.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index b32d1c1..fc7a989 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -5073,13 +5073,12 @@ static int _setup_ssl_threads(void) { if (_ssl_locks == NULL) { _ssl_locks_count = CRYPTO_num_locks(); - _ssl_locks = PyMem_New(PyThread_type_lock, _ssl_locks_count); + _ssl_locks = PyMem_Calloc(_ssl_locks_count, + sizeof(PyThread_type_lock)); if (_ssl_locks == NULL) { PyErr_NoMemory(); return 0; } - memset(_ssl_locks, 0, - sizeof(PyThread_type_lock) * _ssl_locks_count); for (i = 0; i < _ssl_locks_count; i++) { _ssl_locks[i] = PyThread_allocate_lock(); if (_ssl_locks[i] == NULL) { |