summaryrefslogtreecommitdiff
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-03-16 12:21:02 -0500
committerBenjamin Peterson <benjamin@python.org>2012-03-16 12:21:02 -0500
commit3c4e2b43f9ad635037e3fa7b1f8470998d713afc (patch)
treea430d8351a9b598d3f765b412f65ff8ced3b36cd /Python/getargs.c
parent74ab278a902722acd1e450fdf8b338017b47150a (diff)
downloadcpython-3c4e2b43f9ad635037e3fa7b1f8470998d713afc.tar.gz
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 37f1898819..268a1134ea 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);