On CentOS 7 with tcl-8.5.13-8, xhfs failed with SIGABRT in a number of
code paths, including cases where free() was called and eventually
resulted in munmap_chunk() reporting e.g.:
munmap_chunk(): invalid pointer: 0x000000000089df40 ***
and cases where Tcl_Free() was called (presumably internally by Tcl)
and eventually resulted in Tcl_Panic() being called and reporting
e.g.:
alloc: invalid block: 0xb9ce00: 95 8
The failures when calling free() were due to attempts to free memory
that was allocated using Tcl_Alloc() and similar functions (possibly
via other Tcl calls), so this fix replaces some calls to free() with
calls to Tcl_Free().
The failures when calling Tcl_Free() were due to Tcl calling that
function for memory that was passed to it via Tcl_SetResult(..., ...,
TCL_DYNAMIC) when that memory had been allocated using malloc() or
similar functions, so this fix replaces a call to ALLOC() with a call
to Tcl_Alloc(), and copies the malloc()'d buffer returned by
cs_macroman() or cs_latin1() into a Tcl_Alloc()'d buffer.