| Ticket UUID: | 48150cdad29ca6c6db7c1d0c86a18110dfe43d40 | ||
| Title: | Command creation with overwrite (prevention against endless loop by its recreation via trace) is affected by drastic mem-leak | ||
| Type: | Bug | Created on: | 2025-03-27 13:04:53 |
| Submitter: | sebres | Assigned to: | sebres |
| Subsystem: | 46. Traces | Severity: | Important |
| Priority: | 5 Medium | Last modified: | 2025-03-27 13:06:25 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | any | ||
| Description: | ||||
|
The way how command gets (re)created is affected by drastic mem-leak, due to prevention against endless loop by its recreation via trace. The responsible place of code in TclCreateObjCommandInNs, the same is valid for other functions like Tcl_CreateCommand etc. PoC:
By regular deletion it'd restore everything back, but not by overwrite, that wins and this prevention causes that the new command overwrites the old at any cost without proper clean-up, no traces but also no deletion callback, no release for internal members, nothing excepting ckfree for cmdPtr. I'd rather expects that 2nd run of trace is avoided and the command gets deleted and overwritten properly (and surely without the leak). Also if command gets restored again now via deletion callback, it shall win and attempt overwrite must cause something like "cannot create - existing command restored after deletion, avoid endless loop". | ||||
