summaryrefslogtreecommitdiffstats
path: root/Modules/getpath.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-16 11:33:32 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-16 11:33:32 (GMT)
commit4d0d9829851915e97ae392dd803976be6c95c8d1 (patch)
treee93666c54592b95dbca422ec66d0896f827957b3 /Modules/getpath.c
parent53fa8b2a4bbb589d3d761284c70f93e0f852df23 (diff)
parent1a1ff29659f068659dea07f1bd67b8fd4331071c (diff)
downloadcpython-4d0d9829851915e97ae392dd803976be6c95c8d1.zip
cpython-4d0d9829851915e97ae392dd803976be6c95c8d1.tar.gz
cpython-4d0d9829851915e97ae392dd803976be6c95c8d1.tar.bz2
Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer
overflows. Added few missed PyErr_NoMemory().
Diffstat (limited to 'Modules/getpath.c')
-rw-r--r--Modules/getpath.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 11eece4..3564d72 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -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");