mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows. Added few missed PyErr_NoMemory().
This commit is contained in:
parent
e1efc07a30
commit
1a1ff29659
15 changed files with 50 additions and 52 deletions
|
@ -3838,10 +3838,11 @@ static int _setup_ssl_threads(void) {
|
|||
|
||||
if (_ssl_locks == NULL) {
|
||||
_ssl_locks_count = CRYPTO_num_locks();
|
||||
_ssl_locks = (PyThread_type_lock *)
|
||||
PyMem_Malloc(sizeof(PyThread_type_lock) * _ssl_locks_count);
|
||||
if (_ssl_locks == NULL)
|
||||
_ssl_locks = PyMem_New(PyThread_type_lock, _ssl_locks_count);
|
||||
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++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue