]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-103879: Fix refleak in super specialization (#103882)
authorJelle Zijlstra <jelle.zijlstra@gmail.com>
Wed, 26 Apr 2023 15:50:19 +0000 (08:50 -0700)
committerGitHub <noreply@github.com>
Wed, 26 Apr 2023 15:50:19 +0000 (08:50 -0700)
Python/specialize.c

index 9230087a78beac4816dbd331dd3ea63961723a0f..33a3c4561c7ca29b1869c0cd540ada4897ab9a39 100644 (file)
@@ -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: