]> granicus.if.org Git - python/commitdiff
Issue #28188: Use PyMem_Calloc() to get rid of a type-limits warning and an extra...
authorChristian Heimes <christian@python.org>
Tue, 13 Sep 2016 18:48:13 +0000 (20:48 +0200)
committerChristian Heimes <christian@python.org>
Tue, 13 Sep 2016 18:48:13 +0000 (20:48 +0200)
Modules/_ssl.c

index b32d1c1756e16257e8df8e22451735e11705c0b4..fc7a989a8d5dea48f4ce12a78123e244096d16d1 100644 (file)
@@ -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) {