[mapserver-commits] r12781 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed Nov 16 12:18:32 EST 2011


Author: assefa
Date: 2011-11-16 09:18:32 -0800 (Wed, 16 Nov 2011)
New Revision: 12781

Modified:
   trunk/mapserver/mapfile.c
Log:
fix outputformat filename substitution issue (#3751)

Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c	2011-11-16 16:36:44 UTC (rev 12780)
+++ trunk/mapserver/mapfile.c	2011-11-16 17:18:32 UTC (rev 12781)
@@ -5971,7 +5971,8 @@
   const char *filename; 
 
   filename = msGetOutputFormatOption(format, option, NULL);
-  if(filename) {
+  if(filename && strlen(filename)>0) {
+    char *tmpfilename = msStrdup(filename);
     const char *default_key = msFirstKeyFromHashTable(table);
     while(default_key) {
       if(!strncmp(default_key,"default_",8)) {
@@ -5980,7 +5981,7 @@
         char *tag = (char *)msSmallMalloc(buffer_size);
         snprintf(tag, buffer_size, "%%%s%%", &(default_key[8]));
 
-        new_filename = msStrdup(filename);
+        new_filename = msStrdup(tmpfilename);
         new_filename = msCaseReplaceSubstring(new_filename, tag, msLookupHashTable(table, default_key));
         free(tag);
 
@@ -5989,6 +5990,7 @@
       }
       default_key = msNextKeyFromHashTable(table, default_key);
     }
+    msFree(tmpfilename);
   }
   return;
 }



More information about the mapserver-commits mailing list