Browse Source

Vlib: fix memory leaks in read GEOS

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@62073 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 10 năm trước cách đây
mục cha
commit
898e731348
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  1. 6 2
      lib/vector/Vlib/geos.c

+ 6 - 2
lib/vector/Vlib/geos.c

@@ -81,7 +81,7 @@ GEOSGeometry *Vect_read_line_geos(struct Map_info *Map, int line, int *type)
 GEOSGeometry *Vect_read_area_geos(struct Map_info * Map, int area)
 {
     int i, nholes, isle;
-    GEOSGeometry *boundary, **holes;
+    GEOSGeometry *boundary, *poly, **holes;
     
     G_debug(3, "Vect_read_area_geos(): area = %d", area);
 
@@ -105,7 +105,10 @@ GEOSGeometry *Vect_read_area_geos(struct Map_info * Map, int area)
 			  isle, area);
     }
     
-    return GEOSGeom_createPolygon(boundary, holes, nholes);
+    poly = GEOSGeom_createPolygon(boundary, holes, nholes);
+    G_free(holes);
+
+    return poly;
 }
 
 /*!
@@ -508,6 +511,7 @@ GEOSCoordSequence *read_polygon_points(struct Map_info *Map, int n_lines, int *l
 		}
 	    }
 	}
+	GEOSCoordSeq_destroy(pseq[i]);
     }
     
     G_free((void *) pseq);