summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.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/_testcapimodule.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/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index bed6568..74159a7 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -1517,7 +1517,7 @@ unicode_aswidechar(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "Un", &unicode, &buflen))
return NULL;
- buffer = PyMem_Malloc(buflen * sizeof(wchar_t));
+ buffer = PyMem_New(wchar_t, buflen);
if (buffer == NULL)
return PyErr_NoMemory();