Commit e94f2d6
authored
Close connection after error on open (#351)
As per [documentation](https://www.sqlite.org/c3ref/open.html), even when the
database opening failed, we should still run `sqlite3_close()` to free the
resources:
> Whether or not an error occurs when it is opened, resources associated with
> the [database connection](https://www.sqlite.org/c3ref/sqlite3.html) handle
> should be released by passing it to [sqlite3_close()](https://www.sqlite.org/c3ref/close.html)
> when it is no longer required.
I verified this against Python implementation, which
[does this too](https://github.com/python/cpython/blob/357c6500589ca7e065a6c263accfa1307d93c990/Modules/_sqlite/connection.c#L334-L339).
Python also calls `assert` to make sure that closing was clean (it should be per
a comment there), but I think it's not a good idea for a NIF to do such thing.1 parent cbda961 commit e94f2d6
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
461 | 461 | | |
462 | 462 | | |
463 | 463 | | |
| 464 | + | |
464 | 465 | | |
465 | 466 | | |
466 | 467 | | |
| |||
0 commit comments