Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: c167e95467f6a9dd24974bf330cfaf19266fd7bdbb2f903ae8099c9f94706195
Ticket: 9d26c038b9f978196513186f9618cffc65c50656
Potential for memory leaks using Tcl_ListObjIndex on abstract lists
User & Date: apnadkarni on 2026-10-25 02:31:55
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-plain"
  4. comment changed to:
    As documented in the migration guide, since 9.0, `Tcl_ListObjIndex` may return ephemeral `Tcl_Obj` where the returned object is not owned by the (abstract) list implementation. The caller is supposed to take ownership (call IncrRef/DecrRef directly or by adding it to the interpreter result, another list etc.) or free it with `Tcl_BounceRefCount` to ensure unreferenced objects are freed. Lists created with `lseq` are an example.
    
    Several calls to `Tcl_ListObjIndex` do not doing this, both within core as well as in the included packages like ITcl and TDBC drivers, resulting in potential for memory leaks. This is not currently a major issue as lseq is the only such abstract list in the core and is unlikely to be passed as an argument in the context of the core calls where `Tcl_ListObjIndex` is invoked.
    
    Still, it would be advisable to fix this for the future where abstract lists, whether in the core or in extensions, might become more common.
    
  5. foundin changed to: "9.0"
  6. is_private changed to: "0"
  7. login: "apnadkarni"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "9546e9877f1a8899e25a89082561ee694e7fb402"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "apnadkarni"
  14. subsystem changed to: "- New Builtin Commands"
  15. title changed to: "Potential for memory leaks using Tcl_ListObjIndex"
  16. type changed to: "Bug"