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

From: Wesley Darlington (wesley at domain yelsew.com)
Date: Thu 02 Aug 2001 - 09:41:07 IST


On Thu, Aug 02, 2001 at 12:06:47AM +0100, Conor Daly 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?

It leaks.

Wesley.



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