[geos-commits] r2166 - trunk/tests/unit/algorithm/CGAlgorithms

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Aug 18 20:05:04 EDT 2008


Author: mloskot
Date: 2008-08-18 20:05:04 -0400 (Mon, 18 Aug 2008)
New Revision: 2166

Modified:
   trunk/tests/unit/algorithm/CGAlgorithms/isPointInRingTest.cpp
Log:
tests/unit/algorithm/CGAlgorithms: Fixed memory leaks.

Modified: trunk/tests/unit/algorithm/CGAlgorithms/isPointInRingTest.cpp
===================================================================
--- trunk/tests/unit/algorithm/CGAlgorithms/isPointInRingTest.cpp	2008-08-18 23:45:34 UTC (rev 2165)
+++ trunk/tests/unit/algorithm/CGAlgorithms/isPointInRingTest.cpp	2008-08-19 00:05:04 UTC (rev 2166)
@@ -9,8 +9,9 @@
 // GEOS
 #include <geos/algorithm/CGAlgorithms.h>
 #include <geos/geom/Polygon.h>
+#include <geos/geom/Geometry.h>
+#include <geos/geom/CoordinateSequence.h>
 #include <geos/geom/Coordinate.h>
-#include <geos/geom/Geometry.h>
 #include <geos/io/WKTReader.h>
 
 using namespace geos::algorithm;
@@ -25,9 +26,20 @@
     {
 	    typedef std::auto_ptr<geos::geom::Geometry> GeomPtr;
 
+        geos::geom::CoordinateSequence* cs_;
         geos::io::WKTReader reader_;
-
-        test_ispointinring_data() {}
+        
+        test_ispointinring_data()
+            : cs_(0)
+        {
+            assert(0 == cs_);
+        }
+        
+        ~test_ispointinring_data()
+        {
+            delete cs_;
+            cs_ = 0;
+        }
     };
 
     typedef test_group<test_ispointinring_data> group;
@@ -49,7 +61,8 @@
 
         geos::geom::Coordinate pt(10, 10);
 
-        bool isInRing = CGAlgorithms::isPointInRing(pt, geom->getCoordinates());
+        cs_ = geom->getCoordinates();
+        bool isInRing = CGAlgorithms::isPointInRing(pt, cs_);
 
         ensure_equals( true, isInRing );
     }
@@ -66,10 +79,11 @@
 
         geos::geom::Coordinate pt(0, 0);
 
-        bool isInRing = CGAlgorithms::isPointInRing(pt, geom->getCoordinates());
+        cs_ = geom->getCoordinates();
+        bool isInRing = CGAlgorithms::isPointInRing(pt, cs_);
 
         ensure_equals( true, isInRing );
     }
 
+} // namespace tut
 
-} // namespace tut



More information about the geos-commits mailing list