-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/20/2010 03:07 PM, Simon Slavin wrote: > 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. > > Instead check the return value. If you get SQLITE_OK then you need to close > the connection. If you don't, you don't.
That is bad advice! The return code of open is irrelevant. If ppDb is set to non-NULL then you need to call sqlite3_close on it. ppDb will almost always be set to something. One example of when it is not is if there is no memory left in which case it will be set to NULL. Even if the open failed (ie SQLITE_OK not returned) memory is allocated for the error message and code so you do need to call close to free that up. Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwepVcACgkQmOOfHg372QRPUQCcD9J6vSKj+xET5ahV/wLvYE2n SQQAoKwodqyool2QsK6k/vkX2FjolSEk =Kxb1 -----END PGP SIGNATURE----- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users