add sizeof(char) when malloc of char*
though the standard says sizeof(char) is always equal to 1
see http://stackoverflow.com/questions/2215445/are-there-machines-where-sizeofchar-1 for the discussion of sizeof(char)