Commit 7ed67270 authored by Benjamin Peterson's avatar Benjamin Peterson

check result of PyMem_New

parent 49f0b709
...@@ -267,6 +267,10 @@ vgetargs1(PyObject *args, const char *format, va_list *p_va, int flags) ...@@ -267,6 +267,10 @@ vgetargs1(PyObject *args, const char *format, va_list *p_va, int flags)
format = formatsave; format = formatsave;
freelist.entries = PyMem_New(freelistentry_t, max); freelist.entries = PyMem_New(freelistentry_t, max);
if (freelist.entries == NULL) {
PyErr_NoMemory();
return 0;
}
if (compat) { if (compat) {
if (max == 0) { if (max == 0) {
...@@ -1430,6 +1434,10 @@ vgetargskeywords(PyObject *args, PyObject *keywords, const char *format, ...@@ -1430,6 +1434,10 @@ vgetargskeywords(PyObject *args, PyObject *keywords, const char *format,
continue; continue;
freelist.entries = PyMem_New(freelistentry_t, len); freelist.entries = PyMem_New(freelistentry_t, len);
if (freelist.entries == NULL) {
PyErr_NoMemory();
return 0;
}
nargs = PyTuple_GET_SIZE(args); nargs = PyTuple_GET_SIZE(args);
nkeywords = (keywords == NULL) ? 0 : PyDict_Size(keywords); nkeywords = (keywords == NULL) ? 0 : PyDict_Size(keywords);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment