mirror of https://github.com/mattn/go-sqlite3.git
Avoid leaking db if setting busy timeout fails
This commit is contained in:
parent
b2e464529e
commit
4c2dc8806a
|
@ -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)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue