[mapserver-commits] r8980 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Apr 30 00:10:42 EDT 2009


Author: sdlime
Date: 2009-04-30 00:10:42 -0400 (Thu, 30 Apr 2009)
New Revision: 8980

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/maputil.c
Log:
Fixed a memory leak when unescaping quotes in logical expressions. (#2938)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-04-30 04:09:00 UTC (rev 8979)
+++ trunk/mapserver/HISTORY.TXT	2009-04-30 04:10:42 UTC (rev 8980)
@@ -12,6 +12,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Fixed a memory leak when unescaping quotes in	logical	expressions (#2938)
+
 - Fixed template code for item, shpxy and extent tags to properly initialize tag arguments in cases
   where there are mutiple tags in one chunk of template (#2990)
 

Modified: trunk/mapserver/maputil.c
===================================================================
--- trunk/mapserver/maputil.c	2009-04-30 04:09:00 UTC (rev 8979)
+++ trunk/mapserver/maputil.c	2009-04-30 04:10:42 UTC (rev 8980)
@@ -373,7 +373,9 @@
       tmpstr2 = msReplaceSubstring(tmpstr2, "\'", "\\\'");
       tmpstr2 = msReplaceSubstring(tmpstr2, "\"", "\\\"");
       tmpstr = msReplaceSubstring(tmpstr, expression->items[i], tmpstr2);
+      free(tmpstr2);
     }
+
     msAcquireLock( TLOCK_PARSER );
     msyystate = MS_TOKENIZE_EXPRESSION;
     msyystring = tmpstr; /* set lexer state to EXPRESSION_STRING */
@@ -381,18 +383,13 @@
     expresult = msyyresult;
     msReleaseLock( TLOCK_PARSER );
 
-    if (status != 0)
-    {
-        msSetError(MS_PARSEERR, "Failed to parse expression: %s", "msEvalExpression", tmpstr);
-        free(tmpstr);
-        if(tmpstr2)
-          free(tmpstr2);
-            
-        return MS_FALSE;
+    if (status != 0) {
+      msSetError(MS_PARSEERR, "Failed to parse expression: %s", "msEvalExpression", tmpstr);
+      free(tmpstr);
+      return MS_FALSE;
     }
+
     free(tmpstr);
-    if(tmpstr2)
-      free(tmpstr2);
     return expresult;
     
     break;



More information about the mapserver-commits mailing list