[core][test] fix leaks from sqlite usage
This commit is contained in:
committed by
Thiago Marcos P. Santos
parent
0f34eb7b25
commit
1165f62df6
@@ -125,6 +125,7 @@ mapbox::util::variant<Database, Exception> Database::tryOpen(const std::string &
|
||||
const int error = sqlite3_open_v2(filename.c_str(), &db, flags | SQLITE_OPEN_URI, nullptr);
|
||||
if (error != SQLITE_OK) {
|
||||
const auto message = sqlite3_errmsg(db);
|
||||
sqlite3_close(db);
|
||||
return Exception { error, message };
|
||||
}
|
||||
return Database(std::make_unique<DatabaseImpl>(db));
|
||||
|
||||
@@ -278,6 +278,7 @@ SQLite3TestFS::~SQLite3TestFS() {
|
||||
sqlite3_vfs* test_fs = sqlite3_vfs_find("test_fs");
|
||||
if (test_fs) {
|
||||
sqlite3_vfs_unregister(test_fs);
|
||||
sqlite3_free((void*)test_fs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user