[mapserver-commits] r12814 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Sun Nov 27 18:23:37 EST 2011


Author: rouault
Date: 2011-11-27 15:23:37 -0800 (Sun, 27 Nov 2011)
New Revision: 12814

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapogcsld.c
Log:
Fix memory leak in msSLDParseRasterSymbolizer (found by clang static analyzer)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-11-27 21:33:19 UTC (rev 12813)
+++ trunk/mapserver/HISTORY.TXT	2011-11-27 23:23:37 UTC (rev 12814)
@@ -15,6 +15,8 @@
 Current Version (SVN trunk, 6.1-dev, future 6.2): 
 -------------------------------------------------
 
+- Fix memory leak in msSLDParseRasterSymbolizer()
+
 - Fix compilation error with clang in renderers/agg/include/agg_renderer_outline_aa.h
 
 - Add stable hatch rendering (#3847)

Modified: trunk/mapserver/mapogcsld.c
===================================================================
--- trunk/mapserver/mapogcsld.c	2011-11-27 21:33:19 UTC (rev 12813)
+++ trunk/mapserver/mapogcsld.c	2011-11-27 23:23:37 UTC (rev 12814)
@@ -2546,8 +2546,6 @@
     char *pch = NULL, *pchPrevious=NULL;
     
     CPLXMLNode  *psNode=NULL, *psCategorize=NULL;
-    char **papszValues = (char **)malloc(sizeof(char*)*100);
-    char **papszThresholds = (char **)malloc(sizeof(char*)*100);
     char *pszTmp = NULL;
     int nValues=0, nThresholds=0;
     int i,nMaxValues= 100, nMaxThreshold=100;
@@ -2732,8 +2730,8 @@
         }
         else if ((psCategorize = CPLGetXMLNode(psColorMap, "Categorize")))
         {
-            papszValues = (char **)malloc(sizeof(char*)*nMaxValues);
-            papszThresholds = (char **)malloc(sizeof(char*)*nMaxThreshold);
+            char** papszValues = (char **)malloc(sizeof(char*)*nMaxValues);
+            char** papszThresholds = (char **)malloc(sizeof(char*)*nMaxThreshold);
             psNode =  CPLGetXMLNode(psCategorize, "Value");
             while (psNode && psNode->pszValue &&
                    psNode->psChild && psNode->psChild->pszValue)



More information about the mapserver-commits mailing list