There may be several bugs due to calling sqlite3_open(filename, db) while missing call sqlite3_close(db) after use. And I've reported at bibledit-desktop-old
Whether or not an error occurs when it is opened, resources associated with the database connection handle should be released by passing it to sqlite3_close() when it is no longer required.
Since the connection number of database and resource are limited, if we don't close connection in time, it would leak information and affect process running.
If the 5th parameter to sqlite3_exec() is not NULL then any error message is written into memory obtained from sqlite3_malloc() and passed back through the 5th parameter. To avoid memory leaks, the application should invoke sqlite3_free()
Otherwise, the memory consumption might be huge, which may become a DoS.
bug report
missing sqlite3_close() after sqlite3_open()
Hi, developers:
There may be several bugs due to calling
sqlite3_open(filename, db)
while missing callsqlite3_close(db)
after use. And I've reported at bibledit-desktop-oldAccording to SQLite Documention :
Since the connection number of database and resource are limited, if we don't close connection in time, it would leak information and affect process running.
Specific source code locations are below:
src/stylesheetutils.cpp:400
src/stylesheetutils.cpp:380
src/statistics.cpp:95
Beforethrow runtime_error
in line 105, 112, 130, it doesn’t close thedb
.missing sqlite3_free() after sqlite3_exec()
There are maybe several bugs due to calling
sqlite3_exec(db, sql, callback, NULL, errmsg)
while missing callsqlite3_free(errmsg)
after use.SQLite Documention mentions:
Otherwise, the memory consumption might be huge, which may become a DoS.
several examples are below:
/src/keyterms.cpp:131
There is the whole list of locations related to this problem: