Merge pull request #670 from mattn/close-db
Close db even if sqlite3_open_v2 return non-zero.
This commit is contained in:
commit
e924752105
|
@ -1342,6 +1342,9 @@ func (d *SQLiteDriver) Open(dsn string) (driver.Conn, error) {
|
||||||
mutex|C.SQLITE_OPEN_READWRITE|C.SQLITE_OPEN_CREATE,
|
mutex|C.SQLITE_OPEN_READWRITE|C.SQLITE_OPEN_CREATE,
|
||||||
nil)
|
nil)
|
||||||
if rv != 0 {
|
if rv != 0 {
|
||||||
|
if db != nil {
|
||||||
|
C.sqlite3_close_v2(db)
|
||||||
|
}
|
||||||
return nil, Error{Code: ErrNo(rv)}
|
return nil, Error{Code: ErrNo(rv)}
|
||||||
}
|
}
|
||||||
if db == nil {
|
if db == nil {
|
||||||
|
|
Loading…
Reference in New Issue