Commit 99fe0c17 authored by Victor Costan's avatar Victor Costan Committed by Commit Bot

WebSQL: Fix memory leak in SQLite VFS.

The ownership model for SandboxedVfs and SandboxedVfsFile is explained
in class comments. It is not straightforward (smart pointers) because
SandboxedVfs is tied to sqlite3_vfs and SandboxedVfsFile is tied to
sqlite3_file, which are under SQLite's control.

The class comment state that SandboxedVfsFile is deleted when Close() is
called, but the implementation did not do that. This CL fixes the
inconsistency, plugging a small memory leak.

Bug: 1010577, 1009234
Change-Id: I21c819b16e15868bebf6a1a06f1b8de776d100f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1843150
Commit-Queue: Joshua Bell <jsbell@chromium.org>
Auto-Submit: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarJoshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703462}
parent 63a433fc
...@@ -146,6 +146,7 @@ SandboxedVfsFile* SandboxedVfsFile::FromSqliteFile(sqlite3_file* sqlite_file) { ...@@ -146,6 +146,7 @@ SandboxedVfsFile* SandboxedVfsFile::FromSqliteFile(sqlite3_file* sqlite_file) {
int SandboxedVfsFile::Close() { int SandboxedVfsFile::Close() {
file_.Close(); file_.Close();
delete this;
return SQLITE_OK; return SQLITE_OK;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment