Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer

overflows.  Added few missed PyErr_NoMemory().
This commit is contained in:
Serhiy Storchaka 2015-02-16 13:28:22 +02:00
parent e1efc07a30
commit 1a1ff29659
15 changed files with 50 additions and 52 deletions

View file

@ -735,7 +735,7 @@ calculate_path(void)
bufsz += wcslen(zip_path) + 1;
bufsz += wcslen(exec_prefix) + 1;
buf = (wchar_t *)PyMem_Malloc(bufsz * sizeof(wchar_t));
buf = PyMem_New(wchar_t, bufsz);
if (buf == NULL) {
Py_FatalError(
"Not enough memory for dynamic PYTHONPATH");