From: Pablo Galindo Date: Wed, 24 Mar 2021 00:30:02 +0000 (+0000) Subject: bpo-31861: Fix possible crash in PyAnextAwaitable_New (GH-25005) X-Git-Tag: v3.10.0a7~95 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=919d42d477093154a30b55d9d79f023dbbe5614a;p=thirdparty%2FPython%2Fcpython.git bpo-31861: Fix possible crash in PyAnextAwaitable_New (GH-25005) --- diff --git a/Objects/iterobject.c b/Objects/iterobject.c index 06a6da5695f8..f0c6b7991768 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);