Merge pull request #406 from zombiezen/fixleak

Avoid leaking db if setting busy timeout fails
This commit is contained in:
mattn 2017-04-02 23:10:16 +09:00 committed by GitHub
commit c935ccca28
1 changed files with 1 additions and 0 deletions

View File

@ -609,6 +609,7 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
rv = C.sqlite3_busy_timeout(db, C.int(busyTimeout)) rv = C.sqlite3_busy_timeout(db, C.int(busyTimeout))
if rv != C.SQLITE_OK { if rv != C.SQLITE_OK {
C.sqlite3_close_v2(db)
return nil, Error{Code: ErrNo(rv)} return nil, Error{Code: ErrNo(rv)}
} }