Joanne Pham <[EMAIL PROTECTED]> wrote:
> Is it necessary to call only sqlite3_close(pDb) before open another
> connection. Thanks,

No (though it's not clear why you would want multiple connections open 
at the same time). You can open several connections and close them in 
any order.

But in your program, you seem to store the database handle in the same 
global variable for each openDb call. If you call openDb twice, the 
second handle overwrites the first, so now there's no way to call 
sqlite3_close on the first handle. Hence the leak. The situation is not 
much different from this:

int* p = new int;
p = new int;
delete p;
// the first allocation leaks - the pointer to it is lost.

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to