[mapserver-commits] r10764 - branches/branch-5-6/mapserver
svn at osgeo.org
svn at osgeo.org
Thu Nov 25 15:28:32 EST 2010
Author: aboudreault
Date: 2010-11-25 12:28:32 -0800 (Thu, 25 Nov 2010)
New Revision: 10764
Modified:
branches/branch-5-6/mapserver/HISTORY.TXT
branches/branch-5-6/mapserver/shp2img.c
Log:
Backport 5.6: Fixed double free in shp2img.c (#3497)
Modified: branches/branch-5-6/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-6/mapserver/HISTORY.TXT 2010-11-25 20:07:07 UTC (rev 10763)
+++ branches/branch-5-6/mapserver/HISTORY.TXT 2010-11-25 20:28:32 UTC (rev 10764)
@@ -14,6 +14,8 @@
Current Version
---------------
+- Fixed double free in shp2img.c (#3497)
+
- Fixed free(): invalid next size in mapfile.c (#3604)
- Fix for the memory corruption when mapping the string data type in the Java bindings (3491)
Modified: branches/branch-5-6/mapserver/shp2img.c
===================================================================
--- branches/branch-5-6/mapserver/shp2img.c 2010-11-25 20:07:07 UTC (rev 10763)
+++ branches/branch-5-6/mapserver/shp2img.c 2010-11-25 20:28:32 UTC (rev 10764)
@@ -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