summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-03-13 03:27:07 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-03-13 03:27:07 (GMT)
commit6e055d78e16c0af28a35fbad53b99d8be59e1ea3 (patch)
tree1d99c02d8b2a88d0e78940a695ff1a73487235b5 /Modules
parent93dd9b808ec306723878b94dd9b8ab0748e4f1ec (diff)
downloadcpython-6e055d78e16c0af28a35fbad53b99d8be59e1ea3.zip
cpython-6e055d78e16c0af28a35fbad53b99d8be59e1ea3.tar.gz
cpython-6e055d78e16c0af28a35fbad53b99d8be59e1ea3.tar.bz2
sqlite3: Fix a segfault on calling a connection with something else than a
string. Initialize all attributes to be able to call the statement destructor on error. Avoid also a duplicate connection in some tests: setUp() does already open a connection (":memory:").
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_sqlite/connection.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 6bc495a..64e27cd 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -1197,6 +1197,12 @@ PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, Py
return NULL;
}
+ statement->db = NULL;
+ statement->st = NULL;
+ statement->sql = NULL;
+ statement->in_use = 0;
+ statement->in_weakreflist = NULL;
+
rc = pysqlite_statement_create(statement, self, sql);
if (rc != SQLITE_OK) {