[Python-checkins] [3.11] Fix refleak in super_descr_get (GH-104440)

brandtbucher webhook-mailer at python.org
Fri May 12 18:29:08 EDT 2023


https://github.com/python/cpython/commit/4ade7c33696b6a2a2e07295366ae0c29c31bb050
commit: 4ade7c33696b6a2a2e07295366ae0c29c31bb050
branch: 3.11
author: Brandt Bucher <brandtbucher at microsoft.com>
committer: brandtbucher <brandtbucher at gmail.com>
date: 2023-05-12T22:29:02Z
summary:

[3.11] Fix refleak in super_descr_get (GH-104440)

(cherry picked from commit a781484c8e9834538e5ee7b9e2e6bec7b679e033)

files:
M Objects/typeobject.c

diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 90c6425ffdfe..782a7e972288 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;



More information about the Python-checkins mailing list