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