[Python-checkins] cpython (3.6): Issue #28188: Use PyMem_Calloc() to get rid of a type-limits warning and an

christian.heimes python-checkins at python.org
Tue Sep 13 14:48:32 EDT 2016


https://hg.python.org/cpython/rev/9e8e15993aae
changeset:   103773:9e8e15993aae
branch:      3.6
parent:      103771:bedce61ae0a0
user:        Christian Heimes <christian at python.org>
date:        Tue Sep 13 20:48:13 2016 +0200
summary:
  Issue #28188: Use PyMem_Calloc() to get rid of a type-limits warning and an extra memset() call in _ssl.c.

files:
  Modules/_ssl.c |  5 ++---
  1 files changed, 2 insertions(+), 3 deletions(-)


diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -5073,13 +5073,12 @@
 
     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) {

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list