Skip to content
Tcl Source Code History Of Ticket 6d4e9d1af5
Login

History Of Ticket 6d4e9d1af5

Artifacts Associated With Ticket 6d4e9d1af5

  1. Ticket change [fe01f173f4] (rid 210944) by pooryorick on 2023-03-26 10:30:33:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      [https://core.tcl-lang.org/tcl/file?udc=1&ln=2359&ci=c02747a663bc158a&name=generic%2FtclPathObj.c|SetFsPathFromAny]
      duplicates a Tcl_Obj and then stores a pointer to the new object in a
      fsPathPtr, which it then sets as the internal representation of another
      Tcl_Obj, pathPtr.  Because no care is taken to ensure that the internal
      representation of the newly-duplicated Tcl_Obj contains no reference-counted
      copy of pathPtr, it's possible for a situation to arise where pathPtr contains
      a pointer to itself, and that its reference count therefore never drops to 0,
      which is a memory leak.
      
      In test Tcl_Main-2.1 such a situation does in fact occur:  "result" is a
      literal value that, by the time SetFsPathFromAny receives it, has already been
      entered into the literalTable of the interpreter, and has also received an
      internal representation of type "localVarNameType", possibly due to its
      appearance in procedures within msgcat.tcl.  When pathPtr is duplicated,
      DupLocalVarName()
      [https://core.tcl-lang.org/tcl/file?udc=1&ln=5809&ci=c02747a663bc158a&name=generic%2FtclVar.c|makes
      pathPtr the internal representation of the duplicated object], transPtr.  Then
      transPtr is stored in fsPathPtr, which becomtes the internal representation of
      pathPtr.  Valgrind reports still-reachable blocks due to this situation, but
      only when all other tests are deleted from the source file.
      
      Although this issue can be fixed by modifying SetFsPathFromAny, it is yet
      another example of how sharing a single Tcl_Obj between identical literal
      values causes trouble.  First, it creates a situation where there is only one
      internal representation even though the identical literal values may have
      different contexts and interpretations.  Second, it makes errors like this one,
      which can go undiscovered for years, more likely.
      
    5. is_private initialized to: "0"
    6. login: "pooryorick"
    7. priority initialized to: "5 Medium"
    8. private_contact initialized to: "2b2275eab1118e1fab0016cf1c5702893c6af86c"
    9. resolution initialized to: "None"
    10. severity initialized to: "Critical"
    11. status initialized to: "Open"
    12. submitter initialized to: "pooryorick"
    13. subsystem initialized to: "36. Pathname Management"
    14. title initialized to:
      memory leak:  SetFsPathFromAny, assisted by the global literal table, causes a Tcl_Obj to reference itself
      
    15. type initialized to: "Bug"
  2. Ticket change [b66403dab9] (rid 210945) by pooryorick on 2023-03-26 10:30:48:

    1. assignee changed to: "pooryorick"
    2. login: "pooryorick"
    3. mimetype: "text/plain"
  3. Ticket change [55234a87f2] (rid 210955) by pooryorick on 2023-03-26 15:08:55:

    1. icomment: "Fixed in [1ec9da4c469c29f4]."
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
  4. Ticket change [dab9b2e1cc] (rid 210956) by pooryorick on 2023-03-26 15:10:33:

    1. icomment: "Correction: Fixed in [a9c542391a86a9e8]."
    2. login: "pooryorick"
    3. mimetype: "text/x-fossil-wiki"
    4. resolution changed to: "Fixed"
    5. status changed to: "Pending"
  5. Ticket change [6c163527d5] (rid 212961) by pooryorick on 2023-04-15 21:28:55:

    1. closedate changed to: "2460050.39508404"
    2. closer changed to: "pooryorick"
    3. login: "pooryorick"
    4. mimetype: "text/plain"
    5. status changed to: "Closed"