• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Do I need to free() after gethostbyname()?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do I need to free() after gethostbyname()?


  • Subject: Re: Do I need to free() after gethostbyname()?
  • From: Justin Walker <email@hidden>
  • Date: Wed, 29 Sep 2004 11:44:14 -0700


On Sep 29, 2004, at 10:35, Dave Camp wrote:

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

According to the man page, the values returned point to static storage. On the other hand, the code (in the libinfo project) appears to show dynamically allocated storage. I didn't follow all the twisty little passages, so am just guessing about this.


In any case, a bug report might be in order (at least, for the man page).

Regards,

Justin

--
Justin C. Walker, Curmudgeon-At-Large  *
Institute for General Semantics        |   When LuteFisk is outlawed
                                       |   Only outlaws will have
                                       |       LuteFisk
*--------------------------------------*-------------------------------*

_______________________________________________
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


  • Follow-Ups:
    • Re: Do I need to free() after gethostbyname()?
      • From: Allan Nathanson <email@hidden>
References: 
 >Do I need to free() after gethostbyname()? (From: Dave Camp <email@hidden>)

  • Prev by Date: Do I need to free() after gethostbyname()?
  • Next by Date: Re: Do I need to free() after gethostbyname()?
  • Previous by thread: Do I need to free() after gethostbyname()?
  • Next by thread: Re: Do I need to free() after gethostbyname()?
  • Index(es):
    • Date
    • Thread