[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: C programming: Segmentation fault within malloc?



> 
> 
> On Thu, 26 Jul 2001, Shaul Karl wrote:
> 
> > How can it be? If malloc can not allocate memory it should return a NULL 
> > pointer. How can it Seg fault?
> 
> The internal state of the stack became corrupted. Try compiling with
> "-lefence" (electric fence). Then reproduce the error. It will crash
> again, but with a bit of luck at the place where the actual error is.
> 
> Walter
> 


Thank you. 

With efence pin pointing the point of failure I have managed to learn that 
realloc(void*, size_t) frees the other size allocated memory.
For some reason I was convinced that it does not.
-- 

	Shaul Karl <shaulka@bezeqint.net>




Reply to: