[mapserver-dev] Ticket 3559 - malloc/calloc/realloc return values should always be checked

Frank Warmerdam warmerdam at pobox.com
Thu Oct 7 09:35:48 EDT 2010

Alan Boudreault wrote:
> Devs,
> I'm about to begin this task and would like to see if you agree with 
> what I plan to do.
> Basicaly, the task is to pass through the code source and verify that 
> all memory allocation calls are checked. This implies, if the function 
> that contains the memory allocation wasn't already returning any error 
> value to its caller, to add checks in the callers and do the appropriate 
> action.


I'd just like to go on the record and not feeling that it is important
to check all memory allocation return values.  If we get to the point
where small allocations are failing it is unlikely that we will be able
to recover in a meaningful way, and the error checking code may bulk stuff
up in unhelpful ways.  I say, let things segfault - it's as clean an exit
as some others.

Keep in mind our ability to actually *test* the new error cases is minimal.

Just my two cents worth...

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the mapserver-dev mailing list