src/apps/tsql.c:704 uses the locale_charset, which is declared in the libiconv header file localcharset.h. However, this file is not included and the function is assumed to return int instead of const char *. For this reason, the returned char pointer is invalid and tsql segfaults at line 714, when trying to access the string.
A patch is attached, which adds the inclusion of localcharset.h in include/tdsiconv.h
fixed