[core][test] fix leaks from sqlite usage

This commit is contained in:
Dane Springmeyer
2019-08-15 14:02:26 -07:00
committed by Thiago Marcos P. Santos
parent 0f34eb7b25
commit 1165f62df6
2 changed files with 2 additions and 0 deletions

View File

@@ -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));

View File

@@ -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);
}
}