Do I need to free() after gethostbyname()?
Do I need to free() after gethostbyname()?
- Subject: Do I need to free() after gethostbyname()?
- From: Dave Camp <email@hidden>
- Date: Wed, 29 Sep 2004 10:35:00 -0700
I've got some leaks in my program and ObjectAlloc seems to show a leak
for every call to gethostbyname().
The man page for gethostbyname doesn't indicate I need to free the
pointer that is returned and a google on 'gethostbyname free' yields
some hits that indicate that on some systems the pointer is to a static
struct and does not need to be freed, and on others it is malloc'd and
does need to be freed.
What should I be doing on OS X?
For reference, the call stack looks like:
malloc_zone_malloc
malloc
strdup
copy_host
cache_gethostbyname
gethostbynameerrno
gethostbyname
Thanks,
Dave
---
In English, every word can be verbed.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden