check result of PyMem_New
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 @@
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);