Skip to content
Tcl Source Code History Of Ticket 7368d225a6
Login

History Of Ticket 7368d225a6

Artifacts Associated With Ticket 7368d225a6

  1. Ticket change [e68e1974c2] (rid 138615) by dgp on 2014-07-10 14:40:59:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      Tcl_SetVar2() creates the (Tcl_Obj) value out of
      the (const char *) data it receives, then passes
      it on to Tcl_SetVar2Ex() to manage the rest of its
      lifetime.  
      
      This mostly works, so long as Tcl_SetVar2Ex() stores
      the value in a variable.
      
      When flags includes TCL_APPEND_VALUE and does not include
      TCL_LIST_ELEMENT that does not happen and the mem leaks.
      There may be other leak scenarios too.
      
      The testing package pkgua exposes this, when examined with
      valgrind.
      
    5. foundin initialized to: "8.5"
    6. is_private initialized to: "0"
    7. login: "dgp"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "dgp"
    13. subsystem initialized to: "07. Variables"
    14. title initialized to: "Tcl_SetVar2() leaks memory"
    15. type initialized to: "Bug"
  2. Ticket change [777e85d01c] (rid 138616) by dgp on 2014-07-10 14:59:24:

    1. icomment:
      Another likely leak scenario is
      a variable name that cannot be created.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  3. Ticket change [e0887feb41] (rid 138617) by dgp on 2014-07-10 15:04:19:

    1. icomment: "Um, no. The latter case is handled."
    2. login: "dgp"
    3. mimetype: "text/plain"
  4. Ticket change [ed4250409b] (rid 138620) by dgp on 2014-07-10 15:55:34:

    1. icomment:
      
      This is a gap in the fix for bug 1334947.
      
      http://core.tcl.tk/tcl/info/1334947
      
      For all the same reasons that was fixed in 
      a mildly incompatible way, this should also
      be treated the same, with the Tcl_*SetVar*
      machinery taking care of all zero-refcount
      value housekeeping to relieve all callers
      of that burden.
      
      Those harmed will be anyone with code like this:
      
      Tcl_Obj *value = Tcl_New...();
      Tcl_SetVar2Ex(interp, "foo", NULL, value, TCL_APPEND_VALUE);
      Tcl_DecrRefCount(value);
      
      Anyone with such code likely has the Tcl_DecrRefCount()
      call in place only because they added it to plug the memleak
      that would otherwise be observed.  With this change to
      the core, that code will have to modified to continue working
      and avoid a segfault (same as we did with the other 1334947
      changes).  If the code must continue running with older Tcl
      releases, then the fix is to add a
      
      Tcl_IncrRefCount(value);
      
      call prior to SetVar so that refcount management is balanced.
      
      Any such code with the luxury of ditching all old Tcl releases and
      claiming support of solely 8.5.16+ and 8.6.2+ can just drop
      the Tcl_DecrRefCount() call altogether and take advantage of
      the improved interface standard.
      
      I expect to count the number of impacted users on one hand.
      TCL_APPEND_VALUE is just not a popular flag option here in
      my experience.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  5. Ticket change [b3d220aae6] (rid 138624) by dgp on 2014-07-10 16:41:32:

    1. assignee changed to: "dgp"
    2. closedate changed to: "2456849.19551197"
    3. closer changed to: "dgp"
    4. icomment: "Fixed for 8.5.16 and 8.6.2"
    5. login: "dgp"
    6. mimetype: "text/plain"
    7. resolution changed to: "Fixed"
    8. severity changed to: "Important"
    9. status changed to: "Closed"