The String object allocates memory using malloc(). It frees it use free(). So, the memory that it grabs IS freed.
However, the design of the String class is pretty poor. When you allocate a string, it grabs just enough memory for the characters you want to put in it at the time the string is constructed. If you then wish to add a character to the object, it allocates enough space to hold the existing string plus one character, copies the existing data to the new memory, adds the extra character, and frees the memory used by the old string.
For manipulating a few characters, it is OK. For more than a few, it is horribly inefficient. But, it IS easy to use and to explain to newbies now to use.