Skip to content

Commit e93924f

Browse files
committed
fix: out-of-memory error in call to sqlite3_open() on a non-existent SQLite database file
Closes #1367
1 parent 42e5277 commit e93924f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

source/dbconnection.pas

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2833,6 +2833,10 @@ procedure TSQLiteConnection.SetActive(Value: Boolean);
28332833
MainFile := IfThen(FileNames.Count>=1, FileNames[0], '');
28342834

28352835
if Value then begin
2836+
// Fixes "out of memory" crash in sqlite3_open, see issue #1367
2837+
if not FileExists(MainFile) then
2838+
raise EDbError.Create(f_('File does not exist: %s', [MainFile]));
2839+
28362840
DoBeforeConnect;
28372841

28382842
ConnectResult := FLib.sqlite3_open(

0 commit comments

Comments
 (0)