summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDane Springmeyer <dane@mapbox.com>2019-08-15 14:02:26 -0700
committerDane Springmeyer <dane@mapbox.com>2019-08-15 14:02:26 -0700
commit87a56bc0ba21d730230f489a58030fd68a6715fb (patch)
tree9c674c236cfca8ce1d628417b2c2ace38897af38
parent8e1bd18eae73ffbe14aa9297a039e2431d40bd36 (diff)
downloadqtlocation-mapboxgl-upstream/fix-sqlite3-leaks.tar.gz
[core][test] fix leaks from sqlite usageupstream/fix-sqlite3-leaks
-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);
}
}