So I don\'t really know how to put the title this time. First of all I\'d like to say that I\'ve seen several comments on this page about warning if the question is related
The behavior of realloc when the size is 0 is different in C11 (the current version). The standard says (7.20.3.1 for C11, 7.22.3.1 for C1x)
If the size of the space requested is zero, the behavior is implementation-defined: either a null pointer is returned, or the behavior is as if the size were some nonzero value, except that the returned pointer shall not be used to access an object
So, use free and don't rely on realloc.
When dealing with strings via char* always remember to include one extra character for the null terminator \0. This is the usual way to show where the string ends (the other being an explicit string length).
When using malloc and free remember that they must be matched exactly. You need to free the exact pointer (value) returned by malloc or realloc.