summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@protonmail.com>2022-06-21 11:30:29 (GMT)
committerGitHub <noreply@github.com>2022-06-21 11:30:29 (GMT)
commit94eeac03dc8c643ff050e7d0d306637d9556f798 (patch)
tree67841eed2486f1721454385bb67b6d3e2dc8a47f /Modules
parent5fcfdd87c9b5066a581d3ccb4b2fede938f343ec (diff)
downloadcpython-94eeac03dc8c643ff050e7d0d306637d9556f798.zip
cpython-94eeac03dc8c643ff050e7d0d306637d9556f798.tar.gz
cpython-94eeac03dc8c643ff050e7d0d306637d9556f798.tar.bz2
gh-94028: Clear and reset sqlite3 statements properly in cursor iternext (GH-94042)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_sqlite/cursor.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 414584d..3f5cfef 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -1129,10 +1129,13 @@ pysqlite_cursor_iternext(pysqlite_Cursor *self)
self->rowcount = (long)sqlite3_changes(self->connection->db);
}
(void)stmt_reset(self->statement);
+ Py_CLEAR(self->statement);
}
else if (rc != SQLITE_ROW) {
(void)_pysqlite_seterror(self->connection->state,
self->connection->db);
+ (void)stmt_reset(self->statement);
+ Py_CLEAR(self->statement);
Py_DECREF(row);
return NULL;
}