diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-11-18 08:58:20 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-18 08:58:20 -0800 |
commit | ae02a929ddd748b67b3e6f6c6665267f031142e7 (patch) | |
tree | 7ae5c1c1d0e57dad2de8ba348e7e9494c120f192 /Objects | |
parent | e851049e0e045b5e0f9d5c6b8a64d7f6b8ecc9c7 (diff) | |
download | cpython-git-ae02a929ddd748b67b3e6f6c6665267f031142e7.tar.gz |
bpo-35269: Fix a possible segfault involving a newly-created coroutine (GH-10585)
coro->cr_origin wasn't initialized if compute_cr_origin() failed in
PyCoro_New(), which would cause a crash during the coroutine's
deallocation.
https://bugs.python.org/issue35269
(cherry picked from commit 062a57bf4b768ef726975bcc1d34398387520147)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/genobject.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c index e91d11114d..793a809b84 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -1166,11 +1166,11 @@ PyCoro_New(PyFrameObject *f, PyObject *name, PyObject *qualname) ((PyCoroObject *)coro)->cr_origin = NULL; } else { PyObject *cr_origin = compute_cr_origin(origin_depth); + ((PyCoroObject *)coro)->cr_origin = cr_origin; if (!cr_origin) { Py_DECREF(coro); return NULL; } - ((PyCoroObject *)coro)->cr_origin = cr_origin; } return coro; |