Permalink
Browse files

Merge pull request #5329 from gogglesguy/fix-more-misc-leaks

Fix more misc. leaks
  • Loading branch information...
2 parents 8301131 + 1a98652 commit 28991f4eb602bc29156cf7793189b073e9e2f922 @jmckenna jmckenna committed on GitHub Sep 20, 2016
Showing with 18 additions and 0 deletions.
  1. +1 −0 kerneldensity.c
  2. +1 −0 mapogcsld.c
  3. +16 −0 mapwcs20.c
View
@@ -318,6 +318,7 @@ int msComputeKernelDensityDataset(mapObj *map, imageObj *image, layerObj *kernel
msSetError(MS_MISCERR,"msComputeKernelDensityDataset()","failed to create in-memory gdal dataset for interpolated data");
status = MS_FAILURE;
free(iValues);
+ return status;
}
adfGeoTransform[0] = map->extent.minx - map->cellsize * 0.5; /* top left x */
adfGeoTransform[1] = map->cellsize;/* w-e pixel resolution */
View
@@ -106,6 +106,7 @@ int msSLDApplySLDURL(mapObj *map, char *szURL, int iLayer,
unlink(pszSLDTmpFile);
msSetError(MS_WMSERR, "Could not open SLD %s and save it in a temporary file. Please make sure that the sld url is valid and that the temporary path is set. The temporary path can be defined for example by setting TMPPATH in the map file. Please check the MapServer documentation on temporary path settings.", "msSLDApplySLDURL", szURL);
}
+ msFree(pszSLDTmpFile);
if (pszSLDbuf)
nStatus = msSLDApplySLD(map, pszSLDbuf, iLayer, pszStyleLayerName, ppszLayerNames);
}
View
@@ -331,6 +331,7 @@ void msWCSFreeParamsObj20(wcs20ParamsObjPtr params)
}
msFree(params->axes);
CSLDestroy(params->range_subset);
+ CSLDestroy(params->format_options);
msFree(params);
}
@@ -960,14 +961,17 @@ static int msWCSParseRequest20_XMLGetCoverage(
if(NULL == (axis = msWCSFindAxis20(params, axisName))) {
if(NULL == (axis = msWCSCreateAxisObj20())) {
+ xmlFree(axisName);
return MS_FAILURE;
}
axis->name = msStrdup(axisName);
msWCSInsertAxisObj20(params, axis);
}
+ xmlFree(axisName);
content = (char *)xmlNodeGetContent(child);
if(msStringParseInteger(content, &(axis->size)) != MS_SUCCESS) {
+ xmlFree(content);
msSetError(MS_WCSERR, "Value of element 'Size' could not "
"be parsed to a valid integer.",
"msWCSParseRequest20_XMLGetCoverage()");
@@ -988,11 +992,13 @@ static int msWCSParseRequest20_XMLGetCoverage(
if(NULL == (axis = msWCSFindAxis20(params, axisName))) {
if(NULL == (axis = msWCSCreateAxisObj20())) {
+ xmlFree(axisName);
return MS_FAILURE;
}
axis->name = msStrdup(axisName);
msWCSInsertAxisObj20(params, axis);
}
+ xmlFree(axisName);
axis->resolutionUOM = (char *) xmlGetProp(child, BAD_CAST "uom");
@@ -4127,6 +4133,7 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
msInitProjection(&imageProj);
if (msLoadProjectionString(&imageProj, cm.srs) == -1) {
+ msFreeProjection(&imageProj);
msWCSClearCoverageMetadata20(&cm);
msSetError(MS_WCSERR,
"Error loading CRS %s.",
@@ -4139,12 +4146,14 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
for(i = 0; i < params->numaxes; ++i) {
if(params->axes[i]->subset != NULL) {
if(params->axes[i]->subset->timeOrScalar == MS_WCS20_TIME_VALUE) {
+ msFreeProjection(&imageProj);
msWCSClearCoverageMetadata20(&cm);
msSetError(MS_WCSERR, "Time values for subsets are not supported. ",
"msWCSGetCoverage20()");
return msWCSException(map, "InvalidSubsetting", "subset", params->version);
}
if(params->axes[i]->subset->operation == MS_WCS20_SLICE) {
+ msFreeProjection(&imageProj);
msWCSClearCoverageMetadata20(&cm);
msSetError(MS_WCSERR, "Subset operation 'slice' is not supported.",
"msWCSGetCoverage20()");
@@ -4157,11 +4166,13 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
wcs20AxisObjPtr *axes;
axes = msSmallMalloc(sizeof(wcs20AxisObjPtr) * 2);
if(msWCSValidateAndFindAxes20(params, axes) == MS_FAILURE) {
+ msFreeProjection(&imageProj);
msWCSClearCoverageMetadata20(&cm);
msFree(axes);
return msWCSException(map, "InvalidAxisLabel", "subset", params->version);
}
if(msWCSGetCoverage20_FinalizeParamsObj(params, axes) == MS_FAILURE) {
+ msFreeProjection(&imageProj);
msWCSClearCoverageMetadata20(&cm);
msFree(axes);
return msWCSException(map, "InvalidParameterValue", "extent", params->version);
@@ -4213,6 +4224,8 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
/* if the subsets have a crs given, project the image extent to it */
msInitProjection(&subsetProj);
if(msLoadProjectionString(&subsetProj, params->subsetcrs) != MS_SUCCESS) {
+ msFreeProjection(&subsetProj);
+ msFreeProjection(&imageProj);
msWCSClearCoverageMetadata20(&cm);
msSetError(MS_WCSERR,
"Error loading CRS %s.",
@@ -4339,6 +4352,9 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
params->resolutionX = (bbox.maxx - bbox.minx) / params->width;
params->resolutionY = (bbox.maxy - bbox.miny) / params->height;
}
+ else {
+ msFreeProjection(&outputProj);
+ }
}
/* set the bounding box as new map extent */

0 comments on commit 28991f4

Please sign in to comment.