Re: [ILUG] C question [puzzled by strdup()]

From: Waider (waider at domain waider.ie)
Date: Thu 02 Aug 2001 - 09:43:10 IST


At Thursday, 2 August 2001, you wrote:
>The first call to strdup() allocates memory to hold the string and sets
>optionstring to that address. When the second strdup() call passes a
>*new* address to optionstring, what happens the previously allocated
>memory that optionstring *was* pointing to?

Memory leak. Per spec, too. You're responsible for cleaning up memory
allocated by strdup yourself.

Waider.

-- 
waider at domain waider.ie / Yes, it /is/ very personal of me.
http://www.emailreader.co.uk/ - because firewalls suck.
================================================================
Access over 250 professionally developed online training courses
Purchase a 12 months membership online.  Click below for details
      http://training.beginners.co.uk/moreinfo/vid/eml
================================================================


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:11:26 GMT