9fans archive / 1998 / 11 / 82 /    prev next

From: forsyth@cal... forsyth@cal...
Subject: [9fans] How to use strdup()?
Date: Fri, 13 Nov 1998 14:52:48 GMT

>>I'm facing memory problem in news reader having
>>more than 2000 unread articles which
>>uses the strdup() more than 2000 times, and 
>>then  fails in malloc. 

it probably means i didn't consider closely enough when to free
the string passed to plinitlabel etc, and never noticed the program
growing.  i think most of the other strdup'd values are freed correctly.

as several people have said, the result of strdup must
be freed explicitly somewhere.