Issue #18552: Check return value of PyArena_AddPyObject() in obj2ast_object().

This commit is contained in:
Christian Heimes 2013-07-27 00:33:13 +02:00
parent 1acc129d48
commit 70c94e7896
3 changed files with 17 additions and 6 deletions

View file

@ -834,9 +834,13 @@ static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
{
if (obj == Py_None)
obj = NULL;
if (obj)
PyArena_AddPyObject(arena, obj);
Py_XINCREF(obj);
if (obj) {
if (PyArena_AddPyObject(arena, obj) < 0) {
*out = NULL;
return -1;
}
Py_INCREF(obj);
}
*out = obj;
return 0;
}