[mapserver-commits] r8979 - branches/branch-5-4/mapserver

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


Author: sdlime
Date: 2009-04-30 00:09:00 -0400 (Thu, 30 Apr 2009)
New Revision: 8979

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

Modified: branches/branch-5-4/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-4/mapserver/HISTORY.TXT	2009-04-30 03:44:16 UTC (rev 8978)
+++ branches/branch-5-4/mapserver/HISTORY.TXT	2009-04-30 04:09:00 UTC (rev 8979)
@@ -12,6 +12,8 @@
 Current Version:
 ----------------
 
+- Fixed a memory leak when unescaping quotes in logical expressions (#2938)
+
 - Fixed a problem with the iniitialization of tag arguments when multiple item, shpxy or exent
   tags were in the same block of template text being processed (#2990)
 

Modified: branches/branch-5-4/mapserver/maputil.c
===================================================================
--- branches/branch-5-4/mapserver/maputil.c	2009-04-30 03:44:16 UTC (rev 8978)
+++ branches/branch-5-4/mapserver/maputil.c	2009-04-30 04:09:00 UTC (rev 8979)
@@ -373,6 +373,7 @@
       tmpstr2 = msReplaceSubstring(tmpstr2, "\'", "\\\'");
       tmpstr2 = msReplaceSubstring(tmpstr2, "\"", "\\\"");
       tmpstr = msReplaceSubstring(tmpstr, expression->items[i], tmpstr2);
+      free(tmpstr2);
     }
     msAcquireLock( TLOCK_PARSER );
     msyystate = MS_TOKENIZE_EXPRESSION;
@@ -381,20 +382,14 @@
     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;
-    
+    return expresult;    
     break;
   case(MS_REGEX):
     if(itemindex == -1) {



More information about the mapserver-commits mailing list