Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix crashes in :mod:`sqlite3` on memory allocation failure. Patch by Sergey
Fedoseev.
6 changes: 3 additions & 3 deletions Modules/_sqlite/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ int pysqlite_build_row_cast_map(pysqlite_Cursor* self)
}

Py_XSETREF(self->row_cast_map, PyList_New(0));
if (!self->row_cast_map) {
return -1;
}

for (i = 0; i < sqlite3_column_count(self->statement->st); i++) {
converter = NULL;
Expand Down Expand Up @@ -186,9 +189,6 @@ int pysqlite_build_row_cast_map(pysqlite_Cursor* self)
}

if (PyList_Append(self->row_cast_map, converter) != 0) {
if (converter != Py_None) {
Py_DECREF(converter);
}
Py_CLEAR(self->row_cast_map);

return -1;
Expand Down