[mapserver-commits] r7693 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Wed Jun 18 17:04:32 EDT 2008
Author: dmorissette
Date: 2008-06-18 17:04:32 -0400 (Wed, 18 Jun 2008)
New Revision: 7693
Modified:
trunk/mapserver/mapwms.c
Log:
Fixed memory leaks
Modified: trunk/mapserver/mapwms.c
===================================================================
--- trunk/mapserver/mapwms.c 2008-06-18 18:24:26 UTC (rev 7692)
+++ trunk/mapserver/mapwms.c 2008-06-18 21:04:32 UTC (rev 7693)
@@ -1361,24 +1361,23 @@
legendurl = (char*)malloc(strlen(script_url_encoded)+200);
#ifdef USE_GD_PNG
- mimetype = strdup("image/png");
+ mimetype = msEncodeHTMLEntities("image/png");
#endif
#ifdef USE_GD_GIF
if (!mimetype)
- mimetype = strdup("image/gif");
+ mimetype = msEncodeHTMLEntities("image/gif");
#endif
#ifdef USE_GD_JPEG
if (!mimetype)
- mimetype = strdup("image/jpeg");
+ mimetype = msEncodeHTMLEntities("image/jpeg");
#endif
#ifdef USE_GD_WBMP
if (!mimetype)
- mimetype = strdup("image/vnd.wap.wbmp");
+ mimetype = msEncodeHTMLEntities("image/vnd.wap.wbmp");
#endif
if (!mimetype)
- mimetype = MS_IMAGE_MIME_TYPE(map->outputformat);
- mimetype = msEncodeHTMLEntities(mimetype);
+ mimetype = msEncodeHTMLEntities(MS_IMAGE_MIME_TYPE(map->outputformat));
/* -------------------------------------------------------------------- */
/* check if the group parameters for the classes are set. We */
@@ -1419,10 +1418,12 @@
}
for (i=0; i<iclassgroups; i++)
{
+ char *name_encoded = msEncodeHTMLEntities(lp->name);
sprintf(legendurl, "%sversion=%s&service=WMS&request=GetLegendGraphic&layer=%s&format=%s&STYLE=%s",
- script_url_encoded,"1.1.1",msEncodeHTMLEntities(lp->name),
+ script_url_encoded,"1.1.1",name_encoded,
mimetype, classgroups[i]);
-
+ msFree(name_encoded);
+
msIO_fprintf(stdout, " <Style>\n");
msIO_fprintf(stdout, " <Name>%s</Name>\n", classgroups[i]);
msIO_fprintf(stdout, " <Title>%s</Title>\n", classgroups[i]);
More information about the mapserver-commits
mailing list