[geos-commits] r3597 - trunk/src/noding
svn_geos at osgeo.org
svn_geos at osgeo.org
Thu Apr 5 10:37:13 EDT 2012
Author: strk
Date: 2012-04-05 07:37:13 -0700 (Thu, 05 Apr 2012)
New Revision: 3597
Modified:
trunk/src/noding/GeometryNoder.cpp
Log:
Clean memory on exception
Modified: trunk/src/noding/GeometryNoder.cpp
===================================================================
--- trunk/src/noding/GeometryNoder.cpp 2012-04-05 14:23:15 UTC (rev 3596)
+++ trunk/src/noding/GeometryNoder.cpp 2012-04-05 14:37:13 UTC (rev 3597)
@@ -122,9 +122,18 @@
extractSegmentStrings(argGeom, lineList);
Noder& noder = getNoder();
+ SegmentString::NonConstVect* nodedEdges = 0;
- noder.computeNodes( &lineList );
- SegmentString::NonConstVect* nodedEdges = noder.getNodedSubstrings();
+ try {
+ noder.computeNodes( &lineList );
+ nodedEdges = noder.getNodedSubstrings();
+ }
+ catch (const std::exception& ex)
+ {
+ for (size_t i=0, n=lineList.size(); i<n; ++i)
+ delete lineList[i];
+ throw ex;
+ }
std::auto_ptr<geom::Geometry> noded = toGeometry(*nodedEdges);
@@ -134,7 +143,6 @@
for (size_t i=0, n=lineList.size(); i<n; ++i)
delete lineList[i];
- lineList.clear();
return noded;
}
More information about the geos-commits
mailing list