summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2023-05-12 07:11:27 (GMT)
committerGitHub <noreply@github.com>2023-05-12 07:11:27 (GMT)
commita781484c8e9834538e5ee7b9e2e6bec7b679e033 (patch)
treef059a05d4880a4fa93183247264418e0c3e48bb5 /Objects
parent3c2992e58b033a6c8adcb52b53c42a96002e7034 (diff)
downloadcpython-a781484c8e9834538e5ee7b9e2e6bec7b679e033.zip
cpython-a781484c8e9834538e5ee7b9e2e6bec7b679e033.tar.gz
cpython-a781484c8e9834538e5ee7b9e2e6bec7b679e033.tar.bz2
Fix refleak in `super_descr_get` (#104408)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index f40e197..a1ad502 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -10277,8 +10277,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;
+ }
newobj->type = (PyTypeObject*)Py_NewRef(su->type);
newobj->obj = Py_NewRef(obj);
newobj->obj_type = obj_type;