[vtk-developers] vtkImageConvolve crashes when malloc fails

Amy Squillacote ahs at cfdrc.com
Wed Jun 4 11:37:43 EDT 2008


Sean McBride wrote:
> 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.
>   

Actually, I think I was thinking of the "new" operator. See the 
following link: 
http://msdn.microsoft.com/en-us/library/kewsb8ba(VS.80).aspx.

- Amy

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtk-developers mailing list