[geos-commits] r2657 - trunk/source/operation/buffer
svn_geos at osgeo.org
svn_geos at osgeo.org
Mon Oct 5 15:05:02 EDT 2009
Author: strk
Date: 2009-10-05 15:04:56 -0400 (Mon, 05 Oct 2009)
New Revision: 2657
Modified:
trunk/source/operation/buffer/BufferBuilder.cpp
Log:
Finish plugging leaks. Make check runs with no leaks.
Modified: trunk/source/operation/buffer/BufferBuilder.cpp
===================================================================
--- trunk/source/operation/buffer/BufferBuilder.cpp 2009-10-05 18:42:08 UTC (rev 2656)
+++ trunk/source/operation/buffer/BufferBuilder.cpp 2009-10-05 19:04:56 UTC (rev 2657)
@@ -165,13 +165,15 @@
for ( unsigned int i = 0; i < lineList.size(); ++i )
{
CoordinateSequence* seq = lineList[i];
- curveList.push_back( new NodedSegmentString( seq, NULL ) );
+
+ SegmentString* ss = new NodedSegmentString(seq, NULL);
+ curveList.push_back( ss );
}
// Node these SegmentStrings.
Noder* noder = getNoder( precisionModel );
noder->computeNodes( &curveList );
- std::auto_ptr< SegmentString::NonConstVect > nodedEdges ( noder->getNodedSubstrings() );
+ SegmentString::NonConstVect* nodedEdges = noder->getNodedSubstrings();
// Create a geometry out of the noded substrings.
std::vector< Geometry* >* singleSidedNodedEdges =
@@ -180,13 +182,20 @@
{
SegmentString* ss = ( *nodedEdges )[i];
- Geometry* tmp = geomFact->createLineString( ss->getCoordinates() );
- delete ss;
-
+ Geometry* tmp = geomFact->createLineString( ss->getCoordinates()->clone() );
singleSidedNodedEdges->push_back( tmp );
}
- nodedEdges.reset();
+ if ( nodedEdges != &curveList )
+ {
+ delete nodedEdges;
+ }
+
+ for (size_t i=0; i<lineList.size(); ++i)
+ {
+ delete lineList[i];
+ }
+
Geometry* singleSided = geomFact->createMultiLineString(
singleSidedNodedEdges );
@@ -304,6 +313,11 @@
geomFact->destroyGeometry( singleSided );
geomFact->destroyGeometry( intersectedLines );
+ for (size_t i=0; i<curveList.size(); ++i)
+ {
+ delete curveList[i];
+ }
+
if ( mergedLinesGeom->size() > 1 ) return geomFact->createMultiLineString( mergedLinesGeom );
else
{
More information about the geos-commits
mailing list