forked from mirror/go-sqlite3
Close db even if sqlite3_open_v2 return non-zero.
This commit is contained in:
parent
6a9185d7b1
commit
8f4ea282cf
|
@ -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