id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
1854,saveimage crash,brage@…,jmckenna@dmsolutions.ca,"{{{
I have been experiencing the exact same bug as described in bug #1269, with
mapscript terminating in saveimage() while writing to sdout. The httpd process
give the warning ""httpd in free(): error: modified (page-) pointer"" and exits. 

After some debugging, i found that the problematic call is the call to gdFree()
in saveImage().

My setup has php loading both gd.so and php_mapscript.so at startup in
php/extensions.ini.

The problem seems to be a mismatch of gd versions. The php gd module compiles
its own version of libgd, and if the gd library is loaded before the mapscript
library, mapscript will use the php-spesific version. This should not be a
problem, except that the php version of gd.so doesn't export gdFree(). In the
php version of libgd, gdFree() is defined as a macro to efree(). The gdFree()
called by mapscript then belongs to the gd linked to mapscript and the
alloc-code used by msSaveImageBufferGD() and gdFree() does not match.

A workaround is to load the php_mapscript module before the gd module.
}}}",defect,closed,high,5.0 release,MapScript-PHP,4.8,normal,fixed,,jmckenna@…
