[mapguide-trac] #1420: MapGuide Server failed to render JPEG format
imges
MapGuide Open Source
trac_mapguide at osgeo.org
Sat Aug 7 06:02:21 EDT 2010
#1420: MapGuide Server failed to render JPEG format imges
----------------------+-----------------------------------------------------
Reporter: liuar | Owner: liuar
Type: defect | Status: new
Priority: medium | Milestone: 2.3
Component: Server | Version:
Severity: major | Keywords: JPEG
External_id: |
----------------------+-----------------------------------------------------
It is caused by gdImageDestroy(gdImgPalette) at line 1073 in Renderers:
AGGImageIO.[[BR]]
[[BR]]
If the image format is JPEG, the gdImgPalette will never be initialized:
gdImagePtr gdImgPalette = NULL;[[BR]]
[[BR]]
the implementation of gdImageDestroy in gd.cpp
{{{
BGD_DECLARE(void) gdImageDestroy (gdImagePtr im)
{
int i;
if (im->pixels)
{
for (i = 0; (i < im->sy); i++)
{
gdFree (im->pixels[i]);
}
gdFree (im->pixels);
}
if (im->tpixels)
{
for (i = 0; (i < im->sy); i++)
{
gdFree (im->tpixels[i]);
}
gdFree (im->tpixels);
}
if (im->polyInts)
{
gdFree (im->polyInts);
}
if (im->style)
{
gdFree (im->style);
}
gdFree (im);
}
}}}
There will be a NULL pointer pass to method gdImageDestroy.[[BR]]
So it's better to check the gdImgPalette before destroying it.
{{{
if(NULL != gdImgPalette)
gdImageDestroy(gdImgPalette)
}}}
--
Ticket URL: <http://trac.osgeo.org/mapguide/ticket/1420>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals
More information about the mapguide-trac
mailing list