[mapserver-commits] r10485 - sandbox/sdlime/common-expressions/mapserver

svn at osgeo.org svn at osgeo.org
Sun Aug 29 23:50:05 EDT 2010


Author: sdlime
Date: 2010-08-30 03:50:04 +0000 (Mon, 30 Aug 2010)
New Revision: 10485

Modified:
   sandbox/sdlime/common-expressions/mapserver/mapfile.c
Log:
Added cleanup for token list to freeExpression()...

Modified: sandbox/sdlime/common-expressions/mapserver/mapfile.c
===================================================================
--- sandbox/sdlime/common-expressions/mapserver/mapfile.c	2010-08-27 04:18:14 UTC (rev 10484)
+++ sandbox/sdlime/common-expressions/mapserver/mapfile.c	2010-08-30 03:50:04 UTC (rev 10485)
@@ -1872,12 +1872,33 @@
 
 void freeExpression(expressionObj *exp)
 {
+  int i=0;
+
   if(!exp) return;
 
   msFree(exp->string);
   if((exp->type == MS_REGEX) && exp->compiled) ms_regfree(&(exp->regex));
 
-  /* todo: deal with tokens (case statement) */
+  for(i=0; i<exp->numtokens; i++) {
+    switch(exp->tokens[i].token) {
+    case MS_TOKEN_BINDING_DOUBLE:
+    case MS_TOKEN_BINDING_INTEGER:
+    case MS_TOKEN_BINDING_STRING:
+    case MS_TOKEN_BINDING_TIME:
+      msFree(exp->tokens[i].tokenval.bindval.item);
+      break;
+    case MS_TOKEN_LITERAL_TIME:
+      /* anything to do? */
+      break;
+    case MS_TOKEN_LITERAL_STRING:
+      msFree(exp->tokens[i].tokenval.strval);
+      break;
+    case MS_TOKEN_LITERAL_SHAPE:
+      msFreeShape(exp->tokens[i].tokenval.shpval);
+      free(exp->tokens[i].tokenval.shpval);
+      break;
+    }
+  }
 
   initExpression(exp); /* re-initialize */
 }



More information about the mapserver-commits mailing list