forked from mirror/go-sqlcipher
Merge pull request #406 from zombiezen/fixleak
Avoid leaking db if setting busy timeout fails
This commit is contained in:
commit
c935ccca28
|
@ -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