From fb53869e78bd1520b926bef72e4a4ed95f024b95 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 26 Apr 2023 08:51:56 -0600 Subject: [PATCH] gh-103879: Fix refleak in super specialization --- Python/specialize.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Python/specialize.c b/Python/specialize.c index 9230087a78beac..33a3c4561c7ca2 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -544,8 +544,10 @@ _Py_Specialize_LoadSuperAttr(PyObject *global_super, PyObject *class, PyObject * write_u32(cache->self_type_version, Py_TYPE(self)->tp_version_tag); write_obj(cache->method, res); // borrowed instr->op.code = LOAD_SUPER_ATTR_METHOD; + Py_DECREF(res); goto success; } + Py_DECREF(res); SPECIALIZATION_FAIL(LOAD_SUPER_ATTR, SPEC_FAIL_SUPER_NOT_METHOD); fail: