Ticket #4263 (new defect)
Opened 14 months ago
file descriptor and memory leak
|Reported by:||nbrachet||Owned by:||sdlime|
|Component:||MapServer C Library||Version:||unspecified|
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.