If I would write:
char *a=malloc(sizeof(char)*4); a=\"abc\"; char *b=\"abc\";
do I need to free this memory, or is it done by my system?
yes, you need to free the memory returned by malloc.