From 70c94e7896bc46c81e7b9648bde4745ce874f552 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sat, 27 Jul 2013 00:33:13 +0200 Subject: Issue #18552: Check return value of PyArena_AddPyObject() in obj2ast_object(). --- Python/Python-ast.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Python/Python-ast.c') diff --git a/Python/Python-ast.c b/Python/Python-ast.c index d78657ce07..7bf2c5092d 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -688,9 +688,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; } -- cgit v1.2.1