From 540fb3b2d0e94c241576d93480ba7dae47929e8f Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 15 Jul 2024 17:01:39 +0300 Subject: [PATCH] gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` --- Modules/_testcapi/vectorcall.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Modules/_testcapi/vectorcall.c b/Modules/_testcapi/vectorcall.c index b30c5e8704c8af..03aaacb328e0b6 100644 --- a/Modules/_testcapi/vectorcall.c +++ b/Modules/_testcapi/vectorcall.c @@ -348,6 +348,9 @@ static PyObject * MethodDescriptor2_new(PyTypeObject* type, PyObject* args, PyObject *kw) { MethodDescriptor2Object *op = PyObject_New(MethodDescriptor2Object, type); + if (op == NULL) { + return NULL; + } op->base.vectorcall = NULL; op->vectorcall = MethodDescriptor_vectorcall; return (PyObject *)op;