summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2017-09-21 06:47:12 (GMT)
committerBenjamin Peterson <benjamin@python.org>2017-09-21 06:47:12 (GMT)
commit88d0663005d258526496d1f8ee0acb7103c69e80 (patch)
tree97d8dc56d026f5d0b7cbdd46db64e311404b4100 /Modules
parent6b44ad1abdb9b3aaf27e2ba1fc4b69b9a0f50c25 (diff)
downloadcpython-88d0663005d258526496d1f8ee0acb7103c69e80.zip
cpython-88d0663005d258526496d1f8ee0acb7103c69e80.tar.gz
cpython-88d0663005d258526496d1f8ee0acb7103c69e80.tar.bz2
[3.6] closes bpo-31532: Fix memory corruption due to allocator mix (GH-3679) (#3681)
Fix a memory corruption in getpath.c due to mixed memory allocators between Py_GetPath() and Py_SetPath(). The fix use the Raw allocator to mimic the windows version. This patch should be used from python3.6 to the current version for more details, see the bug report and https://github.com/pyinstaller/pyinstaller/issues/2812 (cherry picked from commit 3d1e2ab584ed0175592b5be2a0bc98dc1723776a)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/getpath.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 0f91643..dd3387a 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 = PyMem_New(wchar_t, bufsz);
+ buf = PyMem_RawMalloc(bufsz * sizeof(wchar_t));
if (buf == NULL) {
Py_FatalError(
"Not enough memory for dynamic PYTHONPATH");