How does `gethostbyname` return `struct hostent *` without requiring the caller to release the resource?

Viewed 6713
struct hostent *gethostbyname(const char *name)

Note that hostent.h_addr_list is a field with variant length.

How does the function gethostbyname have the implementation that returns a pointer pointing to a struct but doesn't require the caller to release the resource?

All examples used in the famous book Unix Network Programming Vol 1 by R. Stevens do not contain code to release those returned pointers and I assume that these are not ignorance. Also one example from MSDN does the same thing example of usage

5 Answers
Related