[geos-commits] r2822 - trunk/source/geom/prep

svn_geos at osgeo.org svn_geos at osgeo.org
Fri Dec 11 08:10:32 EST 2009


Author: strk
Date: 2009-12-11 08:10:32 -0500 (Fri, 11 Dec 2009)
New Revision: 2822

Modified:
   trunk/source/geom/prep/BasicPreparedGeometry.cpp
Log:
Fix memory leak in BasicPreparedGeometry::isAnyTargetComponentInTest (issue #308) and drop Coordinate copies from it.


Modified: trunk/source/geom/prep/BasicPreparedGeometry.cpp
===================================================================
--- trunk/source/geom/prep/BasicPreparedGeometry.cpp	2009-12-09 11:10:54 UTC (rev 2821)
+++ trunk/source/geom/prep/BasicPreparedGeometry.cpp	2009-12-11 13:10:32 UTC (rev 2822)
@@ -66,12 +66,12 @@
 bool 
 BasicPreparedGeometry::isAnyTargetComponentInTest( const geom::Geometry * testGeom) const
 {
-	algorithm::PointLocator *locator = new algorithm::PointLocator();
+	algorithm::PointLocator locator;
 
 	for (size_t i=0, n=representativePts.size(); i<n; i++)
 	{
-		geom::Coordinate c = *(representativePts[i]);
-		if ( locator->intersects( c, testGeom) )
+		const geom::Coordinate& c = *(representativePts[i]);
+		if ( locator.intersects( c, testGeom) )
 		return true;
 	}
 	return false;



More information about the geos-commits mailing list