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

  1. #! /usr/bin/env tclsh
  2.  
  3. package require sqlite3
  4. proc p {} {
  5. set statement {select * from t}
  6. db eval $statement {
  7. yield
  8. }
  9. }
  10. sqlite3 db :memory:
  11. db eval {
  12. create table t (v)
  13. ; insert into t(v) values (1) ,(2)
  14. }
  15.  
  16. coroutine p1 p
  17. p1
  18. rename db {}
  19. p1
  20.  
  21.  
  22.  

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.