[LCP]Segmentation Faults when calling free()

Bill Rausch BRausch at owt.com
Fri Feb 21 00:02:02 UTC 2003


At 23:44 -0500 2/19/03, Chuck Martin wrote:
>Could someone tell me what might cause free() to segfault?  I've
>verified that the memory has been previously allocated (using malloc()),
>the correct pointer is being passed to free(), and the memory hasn't
>already been freed with a previous call to free(), so what else could
>it be?

Almost always this is caused by some other error in your program 
involving malloc/free routines.  You've probably overwritten some 
"bookkeeping" information used by the malloc library.  Debugging 
requires much patience and a little luck or using a replacement 
debugging library.

Bill

-- 
Bill Rausch, Software Engineer, UNIX, Mac, Windows



More information about the linuxCprogramming mailing list