Skip to content

SQLite Handle Not Finalized (ARCH9084)

Key swift.performance.sqlite-handle-not-finalized · Severity error · Category performance

Flags sqlite3_open without sqlite3_close, and sqlite3_prepare_v2 without sqlite3_finalize, in the same scope.

sqlite3_prepare_v2(db, sql, -1, &stmt, nil)
while sqlite3_step(stmt) == SQLITE_ROW { }
defer { sqlite3_finalize(stmt) }

Finalize statements and close the database in a defer.