From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 16 Jul 2024 08:51:50 +0000 (+0200) Subject: [3.12] gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (GH... X-Git-Tag: v3.12.5~104 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=106d6456ca8694f435527c064dc27828f965ae41;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (GH-121792) (#121840) gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (GH-121792) (cherry picked from commit 8b6d4755812d0b02e9f26beb9c9a7714e4c5ac28) Co-authored-by: sobolevn --- diff --git a/Modules/_testcapi/vectorcall.c b/Modules/_testcapi/vectorcall.c index dcbc973c9fb9..bf91d0b423eb 100644 --- a/Modules/_testcapi/vectorcall.c +++ b/Modules/_testcapi/vectorcall.c @@ -349,6 +349,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;