Skip to content

Commit 9f6b5ba

Browse files
geographikarouault
authored andcommitted
Initialize status variable for cached WFS results (#5974)
1 parent 40818d4 commit 9f6b5ba

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

mapogroutput.c

+12-11
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ int msOGRWriteFromQuery( mapObj *map, outputFormatObj *format, int sendheaders )
895895
/* Process each layer with a resultset. */
896896
/* ==================================================================== */
897897
for( iLayer = 0; iLayer < map->numlayers; iLayer++ ) {
898-
int status;
898+
int status = 0;
899899
layerObj *layer = GET_LAYER(map, iLayer);
900900
shapeObj resultshape;
901901
OGRLayerH hOGRLayer;
@@ -1106,20 +1106,21 @@ int msOGRWriteFromQuery( mapObj *map, outputFormatObj *format, int sendheaders )
11061106
if( layer->resultcache->results[i].shape )
11071107
{
11081108
/* msDebug("Using cached shape %ld\n", layer->resultcache->results[i].shapeindex); */
1109-
msCopyShape(layer->resultcache->results[i].shape, &resultshape);
1109+
status = msCopyShape(layer->resultcache->results[i].shape, &resultshape);
11101110
}
11111111
else
11121112
{
1113-
status = msLayerGetShape(layer, &resultshape, &(layer->resultcache->results[i]));
1114-
if(status != MS_SUCCESS) {
1115-
OGR_DS_Destroy( hDS );
1116-
msOGRCleanupDS( datasource_name );
1117-
msGMLFreeItems(item_list);
1118-
msFreeShape(&resultshape);
1119-
CSLDestroy(layer_options);
1120-
return status;
1121-
}
1113+
status = msLayerGetShape(layer, &resultshape, &(layer->resultcache->results[i]));
11221114
}
1115+
1116+
if(status != MS_SUCCESS) {
1117+
OGR_DS_Destroy( hDS );
1118+
msOGRCleanupDS( datasource_name );
1119+
msGMLFreeItems(item_list);
1120+
msFreeShape(&resultshape);
1121+
CSLDestroy(layer_options);
1122+
return status;
1123+
}
11231124

11241125
/*
11251126
** Perform classification, and some annotation related magic.

0 commit comments

Comments
 (0)