Permalink
Browse files

fix allocation error

  • Loading branch information...
tbonfort committed Sep 13, 2015
1 parent 0ed57ec commit e8372756dec33aaf55a60430bfd3ca10741c319f
Showing with 6 additions and 3 deletions.
  1. +3 −0 maperror.c
  2. +3 −3 mapmvt.c
@@ -594,6 +594,9 @@ char *msGetVersion()
#ifdef USE_V8_MAPSCRIPT
strcat(version, " SUPPORTS=V8");
#endif
#ifdef USE_PBF
strcat(version, " SUPPORTS=PBF");
#endif
#ifdef USE_JPEG
strcat(version, " INPUT=JPEG");
#endif
@@ -202,15 +202,15 @@ int mvtWriteShape( layerObj *layer, shapeObj *shape, VectorTile__Tile__Layer *mv
mvt_feature->n_geometry = 0;
if(layer->type == MS_LAYER_POINT) {
for(i=0;i<shape->numlines;i++)
mvt_feature->n_geometry += shape->line[i].numpoints;
mvt_feature->n_geometry += shape->line[i].numpoints * 2;
if(mvt_feature->n_geometry)
mvt_feature->n_geometry++; /*command*/
} else if(layer->type == MS_LAYER_LINE) {
for(i=0;i<shape->numlines;i++)
mvt_feature->n_geometry += 2 + shape->line[i].numpoints; /*one moveto, one lineto*/
mvt_feature->n_geometry += 2 + shape->line[i].numpoints * 2; /*one moveto, one lineto*/
} else {
for(i=0;i<shape->numlines;i++)
mvt_feature->n_geometry += 3 + shape->line[i].numpoints; /*one moveto, one lineto, one closepolygon*/
mvt_feature->n_geometry += 3 + shape->line[i].numpoints * 2; /*one moveto, one lineto, one closepolygon*/
}
mvt_feature->geometry = msSmallMalloc(mvt_feature->n_geometry * sizeof(uint32_t));

0 comments on commit e837275

Please sign in to comment.