diff Python/getargs.c @ 75746:2b8994c2851a

check result of PyMem_New
author Benjamin Peterson <benjamin@python.org>
date Fri, 16 Mar 2012 12:21:02 -0500
parents 9fc456ac20cf
children 212f20284724
line wrap: on
line diff
--- a/Python/getargs.c	Fri Mar 16 10:13:30 2012 -0500
+++ b/Python/getargs.c	Fri Mar 16 12:21:02 2012 -0500
@@ -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);