summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-03-16 17:21:02 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-03-16 17:21:02 (GMT)
commit7ed67270a89f77a6063c2fd20153e7f91332f25b (patch)
treecf64710f5c6304cd678fdc5ded6698056ad53370 /Python/getargs.c
parent49f0b70906d0a42c274cb3957ab58bd85e5f4898 (diff)
downloadcpython-7ed67270a89f77a6063c2fd20153e7f91332f25b.zip
cpython-7ed67270a89f77a6063c2fd20153e7f91332f25b.tar.gz
cpython-7ed67270a89f77a6063c2fd20153e7f91332f25b.tar.bz2
check result of PyMem_New
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index 37f1898..268a113 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -267,6 +267,10 @@ vgetargs1(PyObject *args, const char *format, va_list *p_va, int flags)
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 @@ vgetargskeywords(PyObject *args, PyObject *keywords, const char *format,
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);