struct tm *localtime(const time_t *timep);
I checked man localtime but there’s no words on whether it’s my duty to clean it after using.
And in fact I have many similar doubts on functions returning a pointer, how do you determine it should be freed or not ?
This information should be in the man page – my
localtimeman page says:Statically allocated objects should not be passed to
free(), so this is your answer – no, you should not free the return value oflocaltime().The only way to tell in the general case is to consult the documentation or implementation of the function in question.