diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-03-24 00:30:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-24 00:30:02 (GMT) |
commit | 919d42d477093154a30b55d9d79f023dbbe5614a (patch) | |
tree | b7df987025edda24c32969ff57cc194b28d7bbe1 /Objects | |
parent | 57364ce34e0492fbc8b0a6b8c882f384bb489457 (diff) | |
download | cpython-919d42d477093154a30b55d9d79f023dbbe5614a.zip cpython-919d42d477093154a30b55d9d79f023dbbe5614a.tar.gz cpython-919d42d477093154a30b55d9d79f023dbbe5614a.tar.bz2 |
bpo-31861: Fix possible crash in PyAnextAwaitable_New (GH-25005)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/iterobject.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/iterobject.c b/Objects/iterobject.c index 06a6da5..f0c6b79 100644 --- a/Objects/iterobject.c +++ b/Objects/iterobject.c @@ -368,7 +368,11 @@ PyTypeObject PyAnextAwaitable_Type = { PyObject * PyAnextAwaitable_New(PyObject *awaitable, PyObject *default_value) { - anextawaitableobject *anext = PyObject_GC_New(anextawaitableobject, &PyAnextAwaitable_Type); + anextawaitableobject *anext = PyObject_GC_New( + anextawaitableobject, &PyAnextAwaitable_Type); + if (anext == NULL) { + return NULL; + } Py_INCREF(awaitable); anext->wrapped = awaitable; Py_INCREF(default_value); |