Overview
| Artifact ID: | ed4250409bd844f6fe23700c0da1c981f31d5548 |
|---|---|
| Ticket: | 7368d225a657380c364ceb3fcf814bdba374a566
Tcl_SetVar2() leaks memory |
| User & Date: | dgp on 2014-07-10 15:55:34 |
Changes
- 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.
- login: "dgp"
- mimetype: "text/plain"