SQLite database fails to close in SQLiteIDBBackingStore::databaseNameFromFile
authorsihui_liu@apple.com <sihui_liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 May 2020 18:02:57 +0000 (18:02 +0000)
committersihui_liu@apple.com <sihui_liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 May 2020 18:02:57 +0000 (18:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=212090

Reviewed by Darin Adler.

We should finish SQLite statement before closing database.

* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromFile):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262015 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp

index 7844b89..9859316 100644 (file)
@@ -1,3 +1,15 @@
+2020-05-21  Sihui Liu  <sihui_liu@apple.com>
+
+        SQLite database fails to close in SQLiteIDBBackingStore::databaseNameFromFile
+        https://bugs.webkit.org/show_bug.cgi?id=212090
+
+        Reviewed by Darin Adler.
+
+        We should finish SQLite statement before closing database.
+
+        * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+        (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromFile):
+
 2020-05-21  Doug Kelly  <dougk@apple.com>
 
         Dispatch pending events only for current page
index 9f95915..eaad7e9 100644 (file)
@@ -921,13 +921,10 @@ String SQLiteIDBBackingStore::databaseNameFromFile(const String& databasePath)
     }
     if (!database.tableExists("IDBDatabaseInfo"_s)) {
         LOG_ERROR("Could not find IDBDatabaseInfo table and get database name(%i) - %s", database.lastError(), database.lastErrorMsg());
-        database.close();
         return { };
     }
     SQLiteStatement sql(database, "SELECT value FROM IDBDatabaseInfo WHERE key = 'DatabaseName';");
-    auto databaseName = sql.getColumnText(0);
-    database.close();
-    return databaseName;
+    return sql.getColumnText(0);
 }
 
 String SQLiteIDBBackingStore::fullDatabaseDirectoryWithUpgrade()