Quick fix for #1192

Replace all malloc with calloc. Also doubles output buffer for iconv()
just for safety.