Skip to content
Tcl Source Code View Ticket
Login

View Ticket

double free when deleting namespace containing the origin routine for some imported routine

Closed / Fixed1eb488b699d74e0f9d22ea5fc78aa41aa5a77a14Created 6 years agoUpdated 6 years ago
Descriptionwiki2020-08-16 14:45:03
In Tcl -DPURIFY --enable-symbols the following script results in a memory error:

namespace eval test_ns_export {
    namespace export cmd1
    proc cmd1 args {}
}
namespace eval test_ns_import {
    namespace import [namespace parent]::test_ns_export::cmd1
}
proc test_ns_export::cmd1 args {}
catch {namespace delete {*}[namespace children :: test_ns_export]}
return success

The issue is that TclCreateObjCommandInNs() stores in the table of routines for the namespace a pointer to the structure for the new routine, but does not increment the reference count. Eventually this results in the routine structure being freed a second second time.

pooryorickwiki2020-08-16 14:51:59

Fixed in [08e3b17c955f062d].

pooryorick Ticket [1eb488b699]: 3 changes [History diff]2020-08-17 10:21:02
jan.nijtmanswiki2020-08-28 15:22:39

Apparently, this report is for Tcl 8.7.

Fix now merged to core-8-branch.

pooryorick Closed ticket [1eb488b699]. [History diff]2020-08-31 19:06:07
Log in (anonymous is fine) to add a comment.