On Sun, Jun 20, 2010 at 11:07:27PM +0100, Simon Slavin scratched on the wall:
> > From reading the documentation, it looks to me like sqlite3_close() > > should be called if *ppDb has a value, irregardless of the result code > > from the sqlite3_open_v2() call. Is there more to it? > > The ppDb value is about allocating memory. It's possible that > the file might be open and no memory allocated. Or that memory > was allocated and the file not opened. I forget which. Think about this for a second... if it is the first, then you have a dangling file reference the application cannot close. SQLite isn't going to do that. If it is the second, you have leaked memory. SQLite isn't going to do that either. > Instead check the return value. If you get SQLITE_OK then you > need to close the connection. If you don't, you don't. Check the return value, but call sqlite3_close(). Always. It will accept a NULL pointer. -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 [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

