Re: gethostbyname() ---- Delete Resulting Pointer?
- From: Al Balmer <albalmer@xxxxxxx>
- Date: Thu, 06 Dec 2007 21:34:42 GMT
On Thu, 6 Dec 2007 12:25:42 -0800 (PST), aj <aj@xxxxxxxxxx> wrote:
That being said, I have come to conclusion that I am not responsible
for the resulting memory, and have removed the delete call.
Usually, it's not good or necessary to guess about this sort of thing.
The documentation for the function call should tell you whether it is
your responsibility to free the memory.
Another pitfall - some functions might provide a pointer to static
data, which will be overwritten on the next call. In this case, you
need to allocate memory yourself, copy the data, and free the memory
when you're done.
--
Al Balmer
Sun City, AZ
.
- References:
- gethostbyname() ---- Delete Resulting Pointer?
- From: aj
- Re: gethostbyname() ---- Delete Resulting Pointer?
- From: Lew Pitcher
- Re: gethostbyname() ---- Delete Resulting Pointer?
- From: aj
- Re: gethostbyname() ---- Delete Resulting Pointer?
- From: Joachim Schmitz
- Re: gethostbyname() ---- Delete Resulting Pointer?
- From: aj
- Re: gethostbyname() ---- Delete Resulting Pointer?
- From: Lew Pitcher
- Re: gethostbyname() ---- Delete Resulting Pointer?
- From: aj
- gethostbyname() ---- Delete Resulting Pointer?
- Prev by Date: Re: is this newsgroup for newbies
- Next by Date: Re: Structure size directives
- Previous by thread: Re: gethostbyname() ---- Delete Resulting Pointer?
- Next by thread: Re: gethostbyname() ---- Delete Resulting Pointer?
- Index(es):
Relevant Pages
|