Skip to content

Commit 28991f4

Browse files
authored
Merge pull request #5329 from gogglesguy/fix-more-misc-leaks
Fix more misc. leaks
2 parents 8301131 + 1a98652 commit 28991f4

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

kerneldensity.c

+1
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ int msComputeKernelDensityDataset(mapObj *map, imageObj *image, layerObj *kernel
318318
msSetError(MS_MISCERR,"msComputeKernelDensityDataset()","failed to create in-memory gdal dataset for interpolated data");
319319
status = MS_FAILURE;
320320
free(iValues);
321+
return status;
321322
}
322323
adfGeoTransform[0] = map->extent.minx - map->cellsize * 0.5; /* top left x */
323324
adfGeoTransform[1] = map->cellsize;/* w-e pixel resolution */

mapogcsld.c

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ int msSLDApplySLDURL(mapObj *map, char *szURL, int iLayer,
106106
unlink(pszSLDTmpFile);
107107
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);
108108
}
109+
msFree(pszSLDTmpFile);
109110
if (pszSLDbuf)
110111
nStatus = msSLDApplySLD(map, pszSLDbuf, iLayer, pszStyleLayerName, ppszLayerNames);
111112
}

mapwcs20.c

+16
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ void msWCSFreeParamsObj20(wcs20ParamsObjPtr params)
331331
}
332332
msFree(params->axes);
333333
CSLDestroy(params->range_subset);
334+
CSLDestroy(params->format_options);
334335
msFree(params);
335336
}
336337

@@ -960,14 +961,17 @@ static int msWCSParseRequest20_XMLGetCoverage(
960961

961962
if(NULL == (axis = msWCSFindAxis20(params, axisName))) {
962963
if(NULL == (axis = msWCSCreateAxisObj20())) {
964+
xmlFree(axisName);
963965
return MS_FAILURE;
964966
}
965967
axis->name = msStrdup(axisName);
966968
msWCSInsertAxisObj20(params, axis);
967969
}
970+
xmlFree(axisName);
968971

969972
content = (char *)xmlNodeGetContent(child);
970973
if(msStringParseInteger(content, &(axis->size)) != MS_SUCCESS) {
974+
xmlFree(content);
971975
msSetError(MS_WCSERR, "Value of element 'Size' could not "
972976
"be parsed to a valid integer.",
973977
"msWCSParseRequest20_XMLGetCoverage()");
@@ -988,11 +992,13 @@ static int msWCSParseRequest20_XMLGetCoverage(
988992

989993
if(NULL == (axis = msWCSFindAxis20(params, axisName))) {
990994
if(NULL == (axis = msWCSCreateAxisObj20())) {
995+
xmlFree(axisName);
991996
return MS_FAILURE;
992997
}
993998
axis->name = msStrdup(axisName);
994999
msWCSInsertAxisObj20(params, axis);
9951000
}
1001+
xmlFree(axisName);
9961002

9971003
axis->resolutionUOM = (char *) xmlGetProp(child, BAD_CAST "uom");
9981004

@@ -4127,6 +4133,7 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
41274133

41284134
msInitProjection(&imageProj);
41294135
if (msLoadProjectionString(&imageProj, cm.srs) == -1) {
4136+
msFreeProjection(&imageProj);
41304137
msWCSClearCoverageMetadata20(&cm);
41314138
msSetError(MS_WCSERR,
41324139
"Error loading CRS %s.",
@@ -4139,12 +4146,14 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
41394146
for(i = 0; i < params->numaxes; ++i) {
41404147
if(params->axes[i]->subset != NULL) {
41414148
if(params->axes[i]->subset->timeOrScalar == MS_WCS20_TIME_VALUE) {
4149+
msFreeProjection(&imageProj);
41424150
msWCSClearCoverageMetadata20(&cm);
41434151
msSetError(MS_WCSERR, "Time values for subsets are not supported. ",
41444152
"msWCSGetCoverage20()");
41454153
return msWCSException(map, "InvalidSubsetting", "subset", params->version);
41464154
}
41474155
if(params->axes[i]->subset->operation == MS_WCS20_SLICE) {
4156+
msFreeProjection(&imageProj);
41484157
msWCSClearCoverageMetadata20(&cm);
41494158
msSetError(MS_WCSERR, "Subset operation 'slice' is not supported.",
41504159
"msWCSGetCoverage20()");
@@ -4157,11 +4166,13 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
41574166
wcs20AxisObjPtr *axes;
41584167
axes = msSmallMalloc(sizeof(wcs20AxisObjPtr) * 2);
41594168
if(msWCSValidateAndFindAxes20(params, axes) == MS_FAILURE) {
4169+
msFreeProjection(&imageProj);
41604170
msWCSClearCoverageMetadata20(&cm);
41614171
msFree(axes);
41624172
return msWCSException(map, "InvalidAxisLabel", "subset", params->version);
41634173
}
41644174
if(msWCSGetCoverage20_FinalizeParamsObj(params, axes) == MS_FAILURE) {
4175+
msFreeProjection(&imageProj);
41654176
msWCSClearCoverageMetadata20(&cm);
41664177
msFree(axes);
41674178
return msWCSException(map, "InvalidParameterValue", "extent", params->version);
@@ -4213,6 +4224,8 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
42134224
/* if the subsets have a crs given, project the image extent to it */
42144225
msInitProjection(&subsetProj);
42154226
if(msLoadProjectionString(&subsetProj, params->subsetcrs) != MS_SUCCESS) {
4227+
msFreeProjection(&subsetProj);
4228+
msFreeProjection(&imageProj);
42164229
msWCSClearCoverageMetadata20(&cm);
42174230
msSetError(MS_WCSERR,
42184231
"Error loading CRS %s.",
@@ -4339,6 +4352,9 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
43394352
params->resolutionX = (bbox.maxx - bbox.minx) / params->width;
43404353
params->resolutionY = (bbox.maxy - bbox.miny) / params->height;
43414354
}
4355+
else {
4356+
msFreeProjection(&outputProj);
4357+
}
43424358
}
43434359

43444360
/* set the bounding box as new map extent */

0 commit comments

Comments
 (0)