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, it will cause a memory leak. The system could not handle the case.