[mapserver-commits] r11428 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Thu Mar 31 09:53:58 EDT 2011
Author: tbonfort
Date: 2011-03-31 06:53:58 -0700 (Thu, 31 Mar 2011)
New Revision: 11428
Modified:
trunk/mapserver/mapquery.c
Log:
clean up some allocated memory in case of failed queryfile loading
Modified: trunk/mapserver/mapquery.c
===================================================================
--- trunk/mapserver/mapquery.c 2011-03-31 13:48:49 UTC (rev 11427)
+++ trunk/mapserver/mapquery.c 2011-03-31 13:53:58 UTC (rev 11428)
@@ -240,12 +240,16 @@
if(1 != fread(&(GET_LAYER(map, j)->resultcache->numresults), sizeof(int), 1, stream)) { /* number of results */
msSetError(MS_MISCERR,"failed to read number of results from query file stream", "loadQueryResults()");
+ free(GET_LAYER(map, j)->resultcache);
+ GET_LAYER(map, j)->resultcache = NULL;
return MS_FAILURE;
}
GET_LAYER(map, j)->resultcache->cachesize = GET_LAYER(map, j)->resultcache->numresults;
if(1 != fread(&(GET_LAYER(map, j)->resultcache->bounds), sizeof(rectObj), 1, stream)) { /* bounding box */
msSetError(MS_MISCERR,"failed to read bounds from query file stream", "loadQueryResults()");
+ free(GET_LAYER(map, j)->resultcache);
+ GET_LAYER(map, j)->resultcache = NULL;
return MS_FAILURE;
}
@@ -262,6 +266,9 @@
for(k=0; k<GET_LAYER(map, j)->resultcache->numresults; k++) {
if(1 != fread(&(GET_LAYER(map, j)->resultcache->results[k]), sizeof(resultObj), 1, stream)) { /* each result */
msSetError(MS_MISCERR,"failed to read result %d from query file stream", "loadQueryResults()", k);
+ free(GET_LAYER(map, j)->resultcache->results);
+ free(GET_LAYER(map, j)->resultcache);
+ GET_LAYER(map, j)->resultcache = NULL;
return MS_FAILURE;
}
if(!GET_LAYER(map, j)->tileindex) GET_LAYER(map, j)->resultcache->results[k].tileindex = -1; /* reset the tile index for non-tiled layers */
More information about the mapserver-commits
mailing list