aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2023-05-12 15:29:02 -0700
committerGitHub <noreply@github.com>2023-05-12 22:29:02 +0000
commit4ade7c33696b6a2a2e07295366ae0c29c31bb050 (patch)
tree27d077de58e91417a10688dc183c8947f660db1e
parent[3.11] GH-94841: Fix usage of Py_ALWAYS_INLINE (GH-104439) (diff)
downloadcpython-4ade7c33696b6a2a2e07295366ae0c29c31bb050.tar.gz
cpython-4ade7c33696b6a2a2e07295366ae0c29c31bb050.tar.bz2
cpython-4ade7c33696b6a2a2e07295366ae0c29c31bb050.zip
[3.11] Fix refleak in super_descr_get (GH-104440)
(cherry picked from commit a781484c8e9834538e5ee7b9e2e6bec7b679e033)
-rw-r--r--Objects/typeobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 90c6425ffdf..782a7e97228 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -8969,8 +8969,10 @@ super_descr_get(PyObject *self, PyObject *obj, PyObject *type)
return NULL;
newobj = (superobject *)PySuper_Type.tp_new(&PySuper_Type,
NULL, NULL);
- if (newobj == NULL)
+ if (newobj == NULL) {
+ Py_DECREF(obj_type);
return NULL;
+ }
Py_INCREF(su->type);
Py_INCREF(obj);
newobj->type = su->type;