summaryrefslogtreecommitdiff
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-16 13:28:22 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-16 13:28:22 +0200
commit0d27e21ee27525a97b5de29c7b1d6ec276c9b21c (patch)
treed21a890a0a09f229f797b7e08bf7a5e884483eca /Modules/_testcapimodule.c
parent58051da22dec2ad594d794bc99c83624effa9a9a (diff)
downloadcpython-0d27e21ee27525a97b5de29c7b1d6ec276c9b21c.tar.gz
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 625409e56f..cf4b0e14f0 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -1516,7 +1516,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();