Skip to content

Commit dc7f35c

Browse files
committed
WFS: fix segfault when issuing GetFeature on a layer that can't be opened
1 parent 6a5935d commit dc7f35c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

mapwfs.c

+11-3
Original file line numberDiff line numberDiff line change
@@ -3188,9 +3188,8 @@ int msWFSGetFeature(mapObj *map, wfsParamsObj *paramsObj, cgiRequestObj *req,
31883188

31893189
msFreeCharArray(tokens, n);
31903190
msLayerClose(lp);
3191-
}
31923191

3193-
if (strlen(papszPropertyName[k]) > 0) {
3192+
if (strlen(papszPropertyName[k]) > 0) {
31943193

31953194
if (strcasecmp(papszPropertyName[k], "*") == 0) {
31963195
/* Add all non-excluded items, including optional ones */
@@ -3272,8 +3271,17 @@ int msWFSGetFeature(mapObj *map, wfsParamsObj *paramsObj, cgiRequestObj *req,
32723271
msInsertHashTable(&(lp->metadata), "GML_GEOMETRIES", "none");
32733272
}
32743273
}
3275-
} else {/*empty string*/
3274+
} else {/*empty string*/
32763275
msInsertHashTable(&(lp->metadata), "GML_GEOMETRIES", "none");
3276+
}
3277+
}
3278+
else
3279+
{
3280+
msFree(pszPropertyName);
3281+
if( papszPropertyName )
3282+
msFreeCharArray(papszPropertyName, numlayers);
3283+
msFreeCharArray(layers, numlayers);
3284+
return msWFSException(map, "mapserv", "NoApplicableCode", paramsObj->pszVersion);
32773285
}
32783286

32793287
msGMLFreeItems(itemList);

0 commit comments

Comments
 (0)