diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 1bc045523a252e..19d30d24d7f2e7 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -1807,6 +1807,7 @@ pysqlite_connection_exit_impl(pysqlite_Connection *self, PyObject *exc_type, _PyErr_ChainExceptions(exc, val, tb); } else { + Py_DECREF(result); PyErr_Restore(exc, val, tb); } }