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

strk strk at keybit.net
Fri Oct 8 09:00:48 EDT 2010

On: Thursday, October 07, 2010 9:42 AM, Frank Warmerdam wrote:

> I would like to propose an msSmallAlloc() function that behaves in a similar
> fashion, just writing an error to stderr in case of failure and calling
> exit().  Likewise, an msStrdup() with similar behavior.

Better than nothing, but this will fail to be catchable by 
mapscript or the CGI (think XML or in-image exception). 

It's very frustrating when you get a blank image and have
to resort to forcing text/html content type or even worst
reading server logs, and there are already lots of such cases.

I'd recommend going trough allocation calls and check returns.

Would still be nice to have custom allocators/deallocators, but
more for making it easier to introduce optimizations and debug
than anything else. Priority (IMHO) should be given to local
checks (having no exceptions...).


  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html

More information about the mapserver-dev mailing list