diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 570c5012ed8..6bc7676973c 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -8688,6 +8688,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class switch (_PyObject_LookupAttr(py_class, bpy_intern_str_register, &py_cls_meth)) { case 1: { PyObject *ret = PyObject_CallObject(py_cls_meth, NULL); + Py_DECREF(py_cls_meth); if (ret) { Py_DECREF(ret); } @@ -8794,6 +8795,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla switch (_PyObject_LookupAttr(py_class, bpy_intern_str_unregister, &py_cls_meth)) { case 1: { PyObject *ret = PyObject_CallObject(py_cls_meth, NULL); + Py_DECREF(py_cls_meth); if (ret) { Py_DECREF(ret); }