]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (#121792)
authorsobolevn <mail@sobolevn.me>
Tue, 16 Jul 2024 08:29:33 +0000 (11:29 +0300)
committerGitHub <noreply@github.com>
Tue, 16 Jul 2024 08:29:33 +0000 (11:29 +0300)
Modules/_testcapi/vectorcall.c

index b30c5e8704c8af46fe3e2c6d760b9b627fd33d8d..03aaacb328e0b6d15d4a6b764443c026b3160d49 100644 (file)
@@ -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;