From 4c2dc8806aac565a85f1588a7822ae4244cb1c70 Mon Sep 17 00:00:00 2001 From: Ross Light Date: Sat, 1 Apr 2017 08:53:17 -0700 Subject: [PATCH] Avoid leaking db if setting busy timeout fails --- sqlite3.go | 1 + 1 file changed, 1 insertion(+) diff --git a/sqlite3.go b/sqlite3.go index cbde900..d84e6ac 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -609,6 +609,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) { rv = C.sqlite3_busy_timeout(db, C.int(busyTimeout)) if rv != C.SQLITE_OK { + C.sqlite3_close_v2(db) return nil, Error{Code: ErrNo(rv)} }