From 8e5e323bd24c05c55ae983603962bc6138ffcb8b Mon Sep 17 00:00:00 2001 From: Kenichi Ishigaki Date: Sun, 18 Oct 2009 06:03:53 +0000 Subject: [PATCH] DBD::SQLite: sqlite API doc suggests to close the handle you tried to open but failed anyway --- dbdimp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dbdimp.c b/dbdimp.c index f10ffeb..ac9e4c4 100644 --- a/dbdimp.c +++ b/dbdimp.c @@ -80,6 +80,10 @@ sqlite_db_login(SV *dbh, imp_dbh_t *imp_dbh, char *dbname, char *user, char *pas if ((retval = sqlite3_open(dbname, &(imp_dbh->db))) != SQLITE_OK ) { sqlite_error(dbh, (imp_xxh_t*)imp_dbh, retval, (char*)sqlite3_errmsg(imp_dbh->db)); + if (imp_dbh->db) { + /* close the handle anyway */ + sqlite3_close(imp_dbh->db); + } return FALSE; /* -> undef in lib/DBD/SQLite.pm */ } DBIc_IMPSET_on(imp_dbh);