Opened 18 years ago

Closed 18 years ago

#1584 closed defect (fixed)

uninitilazed variable

Reported by: assefa Owned by: mapserverbugs
Priority: high Milestone:
Component: MapScript-PHP Version: 4.8
Severity: normal Keywords:
Cc:

Description

original e-mail from José Luis Campanello (jcampanello@FIBERTEL.COM.AR)

Hi all!

The compilation of mapscript/php generates the following warning:

php_mapscript.c: In function `php3_ms_img_saveImage':
php_mapscript.c:5997: warning: `tmp' might be used uninitialized in this 
function

It seems that it is realy a bug rather than a warning, as the code goes 
something like:

    {           /* no filename - stdout */
        int size=0;
        int   b;
        FILE *tmp;             // ************* HERE SHOULD BE FILE *tmp = 
NULL;
    .......
    .......
    .......
    .......
            if (pImagepath)
            {
                nBufSize = (strlen(pImagepath)) + strlen(PHPMS_G(tmpId)) + 30;
                pBuf = (char*)emalloc(nBufSize);
                nTmpCount = ++(PHPMS_G(tmpCount));
                sprintf(pBuf, "%s%s%d.svg",
                        pImagepath, PHPMS_G(tmpId), nTmpCount);
                tmp = fopen(pBuf, "w");
            }
            //tmp = tmpfile();
            if (tmp == NULL)   // ************ HERE tmp MAY NOT BE INITIALIZED 
(line 6035)
            {
                 _phpms_report_mapserver_error(E_WARNING);
                php3_error(E_ERROR, "Unable to open temporary file for SVG 
output.");
                retVal = -1;
            }

Change History (1)

comment:1 by assefa, 18 years ago

Resolution: fixed
Status: newclosed
fixed in mapserver cvs. Will be avilable for the 4.8 release. 
Note: See TracTickets for help on using tickets.