Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: c86f22a9b34e34f055f63830ffc10db0c3b54402
Ticket: 3598580fffffffffffffffffffffffffffffffff
Tcl_ListObjReplace may release deleted elements too early
User & Date: nijtmans on 2012-12-28 03:58:22
Changes

  1. closedate changed to: "2012-12-27T20:58:22"
  2. closer changed to: "nijtmans"
  3. icomment:
    >Uh, what about a TclDecrRefCountNoDeleteAtZero ?
    Are you serious? Please don't go that way.
    >....my distrust of the choice "create objects at
    > refcount zero"....
    This choice served Tcl well, but it must be used
    with care. transfering an object with refCount=0
    means: please remove it when you are done with
    it. transfering an object with refCount=1 means
    that the caller expects it to exist when the function
    call returns. Unfortunately, Tcl_ListObjReplace
    violates that rule in the TCL_ERROR case, which
    causes a possible memory leak. 
    
    For 8.4, the escape path doesn't exist, so
    everything is OK.
    For 8.[56], the refcounts could be restored by:
    <http://core.tcl.tk/tcl/info/d5147fc677>
    For 9.x, a Tcl_DecrRefCount would be
    better here, noting a POTENTIAL INCOMPATIBILITY.
    
    Alex, (and Don) how do you think about that?
    
    
  4. login: "nijtmans"
  5. mimetype: "text/plain"
  6. status changed to: "Pending"
  7. username: "nijtmans"