[mapserver-commits] r10647 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Fri Oct 22 17:52:24 EDT 2010


Author: aboudreault
Date: 2010-10-22 14:52:23 -0700 (Fri, 22 Oct 2010)
New Revision: 10647

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/shp2img.c
Log:
Fixed double free in shp2img.c (#3497)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2010-10-22 20:44:51 UTC (rev 10646)
+++ trunk/mapserver/HISTORY.TXT	2010-10-22 21:52:23 UTC (rev 10647)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Fixed double free in shp2img.c (#3497)
+
 - Fixed number of CGI params is limited to 100 (#3583)
 
 - Fixed duplicated XML and HTML errors from WFS GetFeature (#3571)

Modified: trunk/mapserver/shp2img.c
===================================================================
--- trunk/mapserver/shp2img.c	2010-10-22 20:44:51 UTC (rev 10646)
+++ trunk/mapserver/shp2img.c	2010-10-22 21:52:23 UTC (rev 10647)
@@ -43,7 +43,6 @@
   int num_layers=0;
 
   int layer_found=0;
-  char *invalid_layer=NULL;
 
   char *outfile=NULL; /* no -o sends image to STDOUT */
 
@@ -256,25 +255,18 @@
       layers = msStringSplit(argv[i+1], ' ', &(num_layers));
 
       for(j=0; j<num_layers; j++) { /* loop over -l */
-        layer_found=0;
-        for(k=0; k<map->numlayers; k++) {
-          if(GET_LAYER(map, k)->name && strcmp(GET_LAYER(map, k)->name, layers[j]) == 0) {
-            layer_found=1;
-            break;
+          layer_found=0;
+          for(k=0; k<map->numlayers; k++) {
+              if(GET_LAYER(map, k)->name && strcmp(GET_LAYER(map, k)->name, layers[j]) == 0) {
+                  layer_found = 1;
+                  break;
+              }
           }
-          else {
-            if (invalid_layer)
-              free(invalid_layer);
-            invalid_layer = strdup(layers[j]);
+          if (layer_found==0) {
+              fprintf(stderr, "Layer (-l) \"%s\" not found\n", layers[j]);
+              msCleanup();
+              exit(0);
           }
-        }
-        if (layer_found==0) {
-          fprintf(stderr, "Layer (-l) %s not found\n", invalid_layer);
-          msCleanup();
-          exit(0);
-        }
-        if (invalid_layer)
-          free(invalid_layer);
       }
 
       for(j=0; j<map->numlayers; j++) {



More information about the mapserver-commits mailing list