summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDane Springmeyer <dane@mapbox.com>2019-08-15 14:02:26 -0700
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2019-08-16 15:51:42 +0300
commit1165f62df6dd344d83f88a6396cfba153e9271f3 (patch)
tree86e108b8b434619d77418d17874cd0298db0731b
parent0f34eb7b253e83b8c4aef7ed6c83cd7b3801fa4c (diff)
downloadqtlocation-mapboxgl-1165f62df6dd344d83f88a6396cfba153e9271f3.tar.gz
[core][test] fix leaks from sqlite usage
-rw-r--r--platform/default/src/mbgl/storage/sqlite3.cpp1
-rw-r--r--test/src/mbgl/test/sqlite3_test_fs.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/platform/default/src/mbgl/storage/sqlite3.cpp b/platform/default/src/mbgl/storage/sqlite3.cpp
index 665e23b437..522210f88f 100644
--- a/platform/default/src/mbgl/storage/sqlite3.cpp
+++ b/platform/default/src/mbgl/storage/sqlite3.cpp
@@ -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));
diff --git a/test/src/mbgl/test/sqlite3_test_fs.cpp b/test/src/mbgl/test/sqlite3_test_fs.cpp
index e4f958c900..068ae9e1cf 100644
--- a/test/src/mbgl/test/sqlite3_test_fs.cpp
+++ b/test/src/mbgl/test/sqlite3_test_fs.cpp
@@ -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);
}
}