From 6e055d78e16c0af28a35fbad53b99d8be59e1ea3 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 13 Mar 2010 03:27:07 +0000 Subject: 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:"). --- Modules/_sqlite/connection.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Modules/_sqlite/connection.c') diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 6bc495a7f4..64e27cd336 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) { -- cgit v1.2.1