]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 16 Jul 2024 08:51:50 +0000 (10:51 +0200)
committerGitHub <noreply@github.com>
Tue, 16 Jul 2024 08:51:50 +0000 (08:51 +0000)
gh-121791: Check for `NULL` in `MethodDescriptor2_new` in `_testcapi` (GH-121792)
(cherry picked from commit 8b6d4755812d0b02e9f26beb9c9a7714e4c5ac28)

Co-authored-by: sobolevn <mail@sobolevn.me>
Modules/_testcapi/vectorcall.c

index dcbc973c9fb991a8a8059a5acc0afc90e589c254..bf91d0b423eb90300fd8201d1cb24b8a02703674 100644 (file)
@@ -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;