[mapserver-commits] r11005 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Thu Feb 24 23:44:30 EST 2011
Author: sdlime
Date: 2011-02-24 20:44:30 -0800 (Thu, 24 Feb 2011)
New Revision: 11005
Modified:
trunk/mapserver/mapwcs20.c
Log:
Applied patch for #3683...
Modified: trunk/mapserver/mapwcs20.c
===================================================================
--- trunk/mapserver/mapwcs20.c 2011-02-23 21:06:04 UTC (rev 11004)
+++ trunk/mapserver/mapwcs20.c 2011-02-25 04:44:30 UTC (rev 11005)
@@ -1444,6 +1444,9 @@
xsi_schemaLocation = msStringConcatenate(xsi_schemaLocation, " ");
xmlNewNsProp(psRootNode, psXsiNs, BAD_CAST "schemaLocation", BAD_CAST xsi_schemaLocation);
+
+ msFree(schemaLocation);
+ msFree(xsi_schemaLocation);
}
/************************************************************************/
@@ -2023,6 +2026,7 @@
VSIUnlink( all_files[i] );
}
+ msFree(filename);
CSLDestroy( all_files );
msReleaseLock( TLOCK_GDAL );
if(multipart)
@@ -2455,9 +2459,6 @@
xmlNsPtr psNsXsi = NULL;
xmlChar *buffer = NULL;
- psNsOws = xmlNewNs(NULL, BAD_CAST MS_OWSCOMMON_OWS_20_NAMESPACE_URI,
- BAD_CAST MS_OWSCOMMON_OWS_NAMESPACE_PREFIX);
-
encoding = msOWSLookupMetadata(&(map->web.metadata), "CO", "encoding");
errorString = msGetErrorString("\n");
errorMessage = msEncodeHTMLEntities(errorString);
@@ -2465,15 +2466,15 @@
psDoc = xmlNewDoc(BAD_CAST "1.0");
- psRootNode = xmlNewNode(psNsOws, BAD_CAST "ExceptionReport");
+ psRootNode = xmlNewNode(NULL, BAD_CAST "ExceptionReport");
psNsOws = xmlNewNs(psRootNode, BAD_CAST MS_OWSCOMMON_OWS_20_NAMESPACE_URI,
BAD_CAST MS_OWSCOMMON_OWS_NAMESPACE_PREFIX);
+ xmlSetNs(psRootNode, psNsOws);
psNsXsi = xmlNewNs(psRootNode, BAD_CAST MS_OWSCOMMON_W3C_XSI_NAMESPACE_URI, BAD_CAST MS_OWSCOMMON_W3C_XSI_NAMESPACE_PREFIX);
/* add attributes to root element */
xmlNewProp(psRootNode, BAD_CAST "version", BAD_CAST version);
-
xmlNewProp(psRootNode, BAD_CAST "xml:lang", BAD_CAST msOWSGetLanguage(map, "exception"));
/* get 2 digits version string: '2.0' */
@@ -2617,6 +2618,8 @@
xmlNewChild(psCSummary, psWcsNs, BAD_CAST "CoverageId", BAD_CAST layer->name);
xmlNewChild(psCSummary, psWcsNs, BAD_CAST "CoverageSubtype", BAD_CAST "RectifiedGridCoverage");
+ msWCSClearCoverageMetadata20(&cm);
+
return MS_SUCCESS;
}
@@ -2777,7 +2780,9 @@
map, params, psDoc, psNode, layer );
if(status != MS_SUCCESS)
{
- return MS_FAILURE;
+ xmlFreeDoc(psDoc);
+ xmlCleanupParser();
+ return msWCSException(map, "mapserv", "Internal", params->version);
}
}
}
@@ -3159,8 +3164,9 @@
if (EQUAL(coverageName, params->ids[0]))
{
layer = GET_LAYER(map, i);
- break;
+ i = map->numlayers; /* to exit loop don't use break, we want to free resources first */
}
+ msFree(coverageName);
}
/* throw exception if no Layer was found */
@@ -3384,7 +3390,6 @@
else
map->cellsize = params->resolutionY;
-
msDebug("msWCSGetCoverage20(): Set parameters from original"
"data. Width: %d, height: %d, cellsize: %f, extent: %f,%f,%f,%f\n",
map->width, map->height, map->cellsize, map->extent.minx,
@@ -3435,6 +3440,7 @@
msLayerSetProcessingKey(layer, "BANDS", bandlist);
snprintf(numbands, sizeof(numbands), "%d", msCountChars(bandlist, ',')+1);
msSetOutputFormatOption(map->outputformat, "BAND_COUNT", numbands);
+ msFree(bandlist);
/* check for the interpolation */
/* TODO: defaults to what? do we need a default? */
@@ -3460,6 +3466,15 @@
}
}
+ /* since the dataset is only used in one layer, set it to be */
+ /* closed after drawing the layer. This normally defaults to */
+ /* DEFER and will produce a memory leak, because the dataset */
+ /* will not be closed. */
+ if( msLayerGetProcessingKey(layer, "CLOSE_CONNECTION") == NULL )
+ {
+ msLayerSetProcessingKey(layer, "CLOSE_CONNECTION", "NORMAL");
+ }
+
/* create the image object */
if (!map->outputformat)
{
@@ -3496,6 +3511,7 @@
}
msDebug("image:%s\n", image->imagepath);
+
/* GML+GeoTIFF */
/* Embed the GeoTIFF into multipart message */
if(params->multipart == MS_TRUE)
@@ -3573,6 +3589,7 @@
}
msWCSClearCoverageMetadata20(&cm);
+ msFreeImage(image);
return MS_SUCCESS;
}
@@ -3691,11 +3708,9 @@
}
msSetError(MS_WCSERR, "Unknown parameter%s: %s.",
"msWCSParseRequest20()", (count > 1) ? "s" : "", concat);
- msWCSException20(map, "InvalidParameterValue", "request",
- params->version );
msFree(concat);
msWCSFreeParamsObj20(params);
- return MS_FAILURE;
+ return msWCSException(map, "InvalidParameterValue", "request", "2.0.0");
}
/* Call operation specific functions */
More information about the mapserver-commits
mailing list