closes bpo-34493: Objects/genobject.c: Add missing NULL check to compute_cr_origin() (GH-8911)
(cherry picked from commit 8fdd331bbf7e60dd81c02c7077f44c7939e2a05d)
Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 88b03c5..e91d111 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -1130,6 +1130,9 @@
/* Now collect them */
PyObject *cr_origin = PyTuple_New(frame_count);
+ if (cr_origin == NULL) {
+ return NULL;
+ }
frame = PyEval_GetFrame();
for (int i = 0; i < frame_count; ++i) {
PyObject *frameinfo = Py_BuildValue(