aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sqlite3.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/sqlite3.go b/sqlite3.go
index 4e94256..f731d20 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -1342,6 +1342,9 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
mutex|C.SQLITE_OPEN_READWRITE|C.SQLITE_OPEN_CREATE,
nil)
if rv != 0 {
+ if db != nil {
+ C.sqlite3_close_v2(db)
+ }
return nil, Error{Code: ErrNo(rv)}
}
if db == nil {