No the memory is not allocated, a simple google search on gmtime will get you to help on this function that explains
Return Value
A pointer to a tm structure with the time information filled in.
This structure is statically allocated and shared by the functions gmtime and localtime. Each time either one of these functions is called the contents of this structure is overwritten.
What this is saying is that the library contains a single statically allocated structure for use by both functions, that is the memory is permanently allocated.
This has the following implications
There is no need to call free on the returned point. In fact calling free is likely to cause a memory exception since you will be trying to free memory that has not been allocated using malloc.
If you are intending to make several calls to gmtime or localtime before using the results then you can not just store the pointer each time because they will all end up pointing to the same location and you will only get 1 result. After each call to gmtime/localtime you would need to copy the structure pointed to to localstorage of your own.
The functions gmtime/localtime are not re-entrant. That is in a multi-tasking program making a call in one task to either function while another task is already in a call to either function will produce unpredictable results. In a multi-tasking environment calls to these functions must be protected so that only 1 call at a time may be in progress.
I've changed now my main reference for C language from "http://www.acm.uiuc.edu/webmonkeys/book/c_guide/" to "http://www.cplusplus.com/reference/", as I see it is more complete
# The functions gmtime/localtime are not re-entrant. That is in a multi-tasking program making a call in one task to either function while another task is already in a call to either function will produce unpredictable results. In a multi-tasking environment calls to these functions must be protected so that only 1 call at a time may be in progress
It was a critical issue I wouldn't have been aware myself. Now I'll use localtime_r() which my system implements.