diff options
author | Christian Heimes <christian@cheimes.de> | 2013-07-27 00:33:35 +0200 |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-07-27 00:33:35 +0200 |
commit | 9096f1e44bfe5c6af229ea32d9df790bbedb4348 (patch) | |
tree | b6aefbf3bad5e9d52af645c62f3591cb9ef86bab /Python/Python-ast.c | |
parent | 70d0128cba691093d2cb863c26433429b485efb4 (diff) | |
parent | da7db911620efbe87a73ed0ea5f2b1e01327505e (diff) | |
download | cpython-9096f1e44bfe5c6af229ea32d9df790bbedb4348.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 49d19dacd6..afa6d2e135 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -704,9 +704,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; } |