[Python-checkins] cpython: check result of PyMem_New
benjamin.peterson
python-checkins at python.org
Fri Mar 16 18:24:27 CET 2012
http://hg.python.org/cpython/rev/2b8994c2851a
changeset: 75746:2b8994c2851a
parent: 75744:8a5b03b77828
user: Benjamin Peterson <benjamin at python.org>
date: Fri Mar 16 12:21:02 2012 -0500
summary:
check result of PyMem_New
files:
Python/getargs.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/Python/getargs.c b/Python/getargs.c
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -267,6 +267,10 @@
format = formatsave;
freelist.entries = PyMem_New(freelistentry_t, max);
+ if (freelist.entries == NULL) {
+ PyErr_NoMemory();
+ return 0;
+ }
if (compat) {
if (max == 0) {
@@ -1430,6 +1434,10 @@
continue;
freelist.entries = PyMem_New(freelistentry_t, len);
+ if (freelist.entries == NULL) {
+ PyErr_NoMemory();
+ return 0;
+ }
nargs = PyTuple_GET_SIZE(args);
nkeywords = (keywords == NULL) ? 0 : PyDict_Size(keywords);
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list