Skip to content

Commit 0201b70

Browse files
blglJulien-Elie
authored andcommitted
ovsqlite: Explicit SQLite init/shutdown
The SQLite docs[1] say that implicit initialization might go away at some point, so add explicit initialization. Also, explicit shutdown might reduce the number of false positives reported by memory leak detectors. [1] https://www.sqlite.org/c3ref/initialize.html
1 parent 7786992 commit 0201b70

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

storage/ovsqlite/ovsqlite-server.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,9 @@ open_db(void)
547547
bool init;
548548
char sqltext[64];
549549

550+
status = sqlite3_initialize();
551+
if (status != SQLITE_OK)
552+
die("SQLite3 initialization failed");
550553
path = concatpath(innconf->pathoverview, OVSQLITE_DB_FILE);
551554
init = stat(path, &sb) == -1;
552555
if (init) {
@@ -663,6 +666,7 @@ close_db(void)
663666
sqlite_helper_term(&sql_main_helper, (sqlite3_stmt **) &sql_main);
664667
sqlite3_close_v2(connection);
665668
connection = NULL;
669+
sqlite3_shutdown();
666670
# ifdef HAVE_ZLIB
667671
if (use_compression) {
668672
inflateEnd(&inflation);

0 commit comments

Comments
 (0)