Changing from a pointer to instead using allocated memory usually means that you tried to use the char * without allocating memory for it. Hence the segmentation fault.