diff options
author | Christian Heimes <christian@cheimes.de> | 2013-07-27 00:33:13 +0200 |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-07-27 00:33:13 +0200 |
commit | da7db911620efbe87a73ed0ea5f2b1e01327505e (patch) | |
tree | a63dc39751bb88d59ce1a74118899adc3188978a /Python/Python-ast.c | |
parent | f5b460e80170bc0f3affad1aaa4d43bb226967c6 (diff) | |
download | cpython-da7db911620efbe87a73ed0ea5f2b1e01327505e.tar.gz |
Issue #18552: Check return value of PyArena_AddPyObject() in obj2ast_object().
Diffstat (limited to 'Python/Python-ast.c')
-rw-r--r-- | Python/Python-ast.c | 10 |
1 files changed, 7 insertions, 3 deletions
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; } |