/ View Ticket
Ticket UUID: 1751725cd6d70274372ab2db5bb91dbf1a3bb6ae
Title: sqlite_close doc should qualify advice
Status: Fixed Type: Documentation
Severity: Important Priority: Immediate
Subsystem: Documentation Resolution: Fixed
Last Modified: 2009-10-20 14:24:28
Version Found In: 3.6.0

The advice in sqlite3_close doc to use sqlite3_next_stmt to close open statements should be more qualified. In my opinion it should be removed completely or suggested as a way of finding open statements if a close fails, but not used to finalize statements.

If the program had not been keeping track of statements then it would leak them anyway. If any extension module or other code is in use then it is quite possible that they have their own prepared statements and so the suggested code would result in a double free. One example module that does this is RTree.

drh added on 2009-10-20 14:24:28:
Check-in [f494ed38a8d3fabb7a064ba4a860d5288c5a571b].