Opened 14 years ago

Closed 14 years ago

#1420 closed defect (fixed)

MapGuide Server failed to render JPEG format imges

Reported by: liuar Owned by: liuar
Priority: medium Milestone: 2.3
Component: Server Version:
Severity: major Keywords: JPEG
Cc: External ID:

Description

It is caused by gdImageDestroy(gdImgPalette) at line 1073 in Renderers: AGGImageIO.

If the image format is JPEG, the gdImgPalette will never be initialized: gdImagePtr gdImgPalette = NULL;

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.
So it's better to check the gdImgPalette before destroying it.

if(NULL != gdImgPalette)
    gdImageDestroy(gdImgPalette)

Change History (1)

comment:1 by liuar, 14 years ago

Resolution: fixed
Status: newclosed

Fixed at [5076]

Note: See TracTickets for help on using tickets.