@xcombelle noticed malloc calls wasn't followed by free in the library source code.
At writing time, this probably occured:
- static strings was passed to the TCL interpreter
- they was rightly declared as static
- compiler complained a const string doesn't match Tcl_Setresult char* signature
- code switched to char*
- code doesn't make anymore any warranty of immutability, but advertise so to TCL
This comp.lang.tcl post by Adrian Ho explains very well the difference between TCL_STATIC and TCL_DYNAMIC in term of promises done by the library code to the TCL interpreter.
It seems if we only want to free the pointer, the macro TCL_DYNAMIC could be use. If we need more complex behavior, a callback should be provided.
Relevant files repository: