[geos-commits] r3592 - trunk/src/noding

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Apr 5 08:05:34 EDT 2012


Author: strk
Date: 2012-04-05 05:05:34 -0700 (Thu, 05 Apr 2012)
New Revision: 3592

Modified:
   trunk/src/noding/IteratedNoder.cpp
Log:
Fix memory leak with IteratedNoder

Modified: trunk/src/noding/IteratedNoder.cpp
===================================================================
--- trunk/src/noding/IteratedNoder.cpp	2012-04-05 11:07:44 UTC (rev 3591)
+++ trunk/src/noding/IteratedNoder.cpp	2012-04-05 12:05:34 UTC (rev 3592)
@@ -60,8 +60,20 @@
 	nodedSegStrings = segStrings;
 	int nodingIterationCount = 0;
 	int lastNodesCreated = -1;
+	vector<SegmentString*> *lastStrings = 0;
 	do {
+
+		// NOTE: will change this.nodedSegStrings
 		node(nodedSegStrings, &numInteriorIntersections);
+
+		// Delete noded strings from previous iteration
+		if ( lastStrings ) {
+			for ( unsigned int i = 0, n = lastStrings->size(); i < n; ++i )
+				delete (*lastStrings)[i];
+			delete lastStrings;
+		}
+		lastStrings = nodedSegStrings;
+
 		nodingIterationCount++;
 		int nodesCreated = numInteriorIntersections;
 



More information about the geos-commits mailing list