[vtk-developers] vtkImageConvolve crashes when malloc fails

Sean McBride sean at rogue-research.com
Wed Jun 4 11:08:36 EDT 2008


On 6/3/08 3:51 PM, Amy Squillacote said:

>Additionally, I don't think malloc is guaranteed to return NULL when it 
>fails to allocate memory (although in many implementations, that is what 
>it does), so adding such checks into VTK wouldn't necessarily work 
>everywhere.

I'm pretty sure you are mistaken.  If malloc() is unable to fulfil a
request, what would it return other than null?  A random value?  I've
googled a bit and everything I've found says it always returns null on
failure.

Perhaps you are thinking of malloc(0)?  On some implementations this
returns null and on others it returns a non-null pointer that is pretty
much useless anyway.

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the vtk-developers mailing list