[Python-checkins] cpython (3.3): use PyMem_NEW to detect overflow (closes #23362)
benjamin.peterson
python-checkins at python.org
Mon Mar 2 19:24:38 CET 2015
https://hg.python.org/cpython/rev/21cd7f83e0aa
changeset: 94832:21cd7f83e0aa
branch: 3.3
parent: 94827:84025a32fa2b
user: Benjamin Peterson <benjamin at python.org>
date: Mon Mar 02 13:23:25 2015 -0500
summary:
use PyMem_NEW to detect overflow (closes #23362)
files:
Objects/unicodeobject.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8501,7 +8501,7 @@
/* allocate enough for a simple 1:1 translation without
replacements, if we need more, we'll resize */
osize = size;
- output = PyMem_Malloc(osize * sizeof(Py_UCS4));
+ output = PyMem_NEW(Py_UCS4, osize);
opos = 0;
if (output == NULL) {
PyErr_NoMemory();
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list