Posted to tcl by Poor Yorick at Thu Apr 09 21:06:40 GMT 2020view pretty

#! /usr/bin/env tclsh

package require sqlite3
proc p {} {
    set statement {select * from t}
    db eval $statement {
        yield
    }
}
sqlite3 db :memory:
db eval {
    create table t (v)
    ; insert into t(v) values (1) ,(2)
}

coroutine p1 p 
p1
rename db {}
p1


Comments

Posted by Poor Yorick at Thu Apr 09 21:06:55 GMT 2020 [text] [code]

The SqliteDb structure is released then the database routine is deleted, but then later dbReleaseStmt() attempts to access that structure.

Posted by Poor Yorick at Thu Apr 09 21:08:36 GMT 2020 [text] [code]

To see the issue, compile with symbols and follow along with gdb.