id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
4263,file descriptor and memory leak,nbrachet,sdlime,"I'm not quite sure how it happens but I believe when a layer has a TILEINDEX file msTiledSHPOpenFile() is called twice, once from the msQuery*() call, then again from the msLayerOpen() call.

Our exact sequence (from Java) is:
{{{
            int rc = layer.queryByPoint(map,
                                        point,
                                        mode,
                                        buffer);
            if (rc != MS_SUCCESS)
                return rc;

            rc = layer.open();
            if (rc != MS_SUCCESS)
                return rc;

            return MS_SUCCESS;
}}}

msTiledSHPOpenFile() blindly overwrites layer->layerinfo. Obviously when layer->layerinfo already points to a msTiledSHPLayerInfo and its opened file descriptors are leaked.

The attached patch is merely plugging the hole. The actual fix might be more complicated.",defect,new,normal,6.0.2 release,MapServer C Library,unspecified,normal,,,
