On Tue, May 15, 2012 at 10:17:41PM +0300, Baruch Burstein scratched on the wall: > Which of the following should I be running right before calling > sqlite3_close? > > while(stmt = sqlite3_next_stmt(db, stmt)) > sqlite3_finalize(stmt); > > while(stmt = sqlite3_next_stmt(db, NULL)) > sqlite3_finalize(stmt); > > I am not sure which will have the desired effect.
The second, since "stmt" will be an invalid pointer by the time the loop comes around and hits sqlite3_next_stmt() again. Ideally, however, your application should manage its own statements correctly. This type of brute-force clean-up can act as a safety net, but it can also leave dangling pointers elsewhere in the code. Something in your code must know about those statements... and if not, then you're leaking memory, which is just as bad. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users