[geos-commits] r3075 - in trunk/tests/unit: capi geom
svn_geos at osgeo.org
svn_geos at osgeo.org
Thu Jun 24 10:40:01 EDT 2010
Author: warmerdam
Date: 2010-06-24 14:40:01 +0000 (Thu, 24 Jun 2010)
New Revision: 3075
Modified:
trunk/tests/unit/capi/GEOSGeomToWKTTest.cpp
trunk/tests/unit/capi/GEOSGeom_extractUniquePointsTest.cpp
trunk/tests/unit/geom/PointTest.cpp
Log:
fix memory leaks
Modified: trunk/tests/unit/capi/GEOSGeomToWKTTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSGeomToWKTTest.cpp 2010-06-24 14:10:19 UTC (rev 3074)
+++ trunk/tests/unit/capi/GEOSGeomToWKTTest.cpp 2010-06-24 14:40:01 UTC (rev 3075)
@@ -198,6 +198,7 @@
GEOSWKTWriter_getOutputDimension(writer) == 3 );
test_writer_wkt(writer, "POINT Z (10 13 3)");
+ GEOSWKTWriter_destroy( writer );
}
} // namespace tut
Modified: trunk/tests/unit/capi/GEOSGeom_extractUniquePointsTest.cpp
===================================================================
--- trunk/tests/unit/capi/GEOSGeom_extractUniquePointsTest.cpp 2010-06-24 14:10:19 UTC (rev 3074)
+++ trunk/tests/unit/capi/GEOSGeom_extractUniquePointsTest.cpp 2010-06-24 14:40:01 UTC (rev 3075)
@@ -21,6 +21,7 @@
{
GEOSGeometry* geom1_;
GEOSGeometry* geom2_;
+ GEOSGeometry* geom3_;
GEOSContextHandle_t handle_;
static void notice(const char *fmt, ...)
@@ -36,7 +37,7 @@
}
test_capigeosextractuniquepoints_data()
- : geom1_(0), geom2_(0)
+ : geom1_(0), geom2_(0), geom3_(0)
{
handle_ = initGEOS_r(notice, notice);
}
@@ -45,8 +46,12 @@
{
GEOSGeom_destroy_r(handle_, geom1_);
GEOSGeom_destroy_r(handle_, geom2_);
+ if( geom3_ )
+ GEOSGeom_destroy_r(handle_, geom3_);
+
geom1_ = 0;
geom2_ = 0;
+ geom3_ = 0;
finishGEOS_r(handle_);
}
@@ -67,8 +72,8 @@
{
geom1_ = GEOSGeomFromWKT_r(handle_, "POLYGON EMPTY");
/* ensure_equals(GEOSGetNumGeometries_r(handle_, geom2_), 0); */
- ensure(GEOSisEmpty_r(handle_,
- GEOSGeom_extractUniquePoints_r(handle_, geom1_)));
+ geom3_ = GEOSGeom_extractUniquePoints_r(handle_, geom1_);
+ ensure(GEOSisEmpty_r(handle_, geom3_));
}
template<>
@@ -78,9 +83,8 @@
geom1_ = GEOSGeomFromWKT_r(handle_, "MULTIPOINT(0 0, 0 0, 1 1)");
geom2_ = GEOSGeomFromWKT_r(handle_, "MULTIPOINT(0 0, 1 1)");
/* ensure_equals(GEOSGetNumGeometries_r(handle_, geom2_), 0); */
- ensure(GEOSEquals_r(handle_,
- GEOSGeom_extractUniquePoints_r(handle_, geom1_),
- geom2_));
+ geom3_ = GEOSGeom_extractUniquePoints_r(handle_, geom1_);
+ ensure(GEOSEquals_r(handle_, geom3_, geom2_));
}
template<>
@@ -89,10 +93,9 @@
{
geom1_ = GEOSGeomFromWKT_r(handle_, "GEOMETRYCOLLECTION(MULTIPOINT(0 0, 0 0, 1 1),LINESTRING(1 1, 2 2, 2 2, 0 0),POLYGON((5 5, 0 0, 0 2, 2 2, 5 5)))");
geom2_ = GEOSGeomFromWKT_r(handle_, "MULTIPOINT(0 0, 1 1, 2 2, 5 5, 0 2)");
+ geom3_ = GEOSGeom_extractUniquePoints_r(handle_, geom1_);
/* ensure_equals(GEOSGetNumGeometries_r(handle_, geom2_), 0); */
- ensure(GEOSEquals_r(handle_,
- GEOSGeom_extractUniquePoints_r(handle_, geom1_),
- geom2_));
+ ensure(GEOSEquals_r(handle_, geom3_, geom2_));
}
Modified: trunk/tests/unit/geom/PointTest.cpp
===================================================================
--- trunk/tests/unit/geom/PointTest.cpp 2010-06-24 14:10:19 UTC (rev 3074)
+++ trunk/tests/unit/geom/PointTest.cpp 2010-06-24 14:40:01 UTC (rev 3075)
@@ -523,9 +523,13 @@
ensure( p->getCoordinateDimension() == 3 );
+ delete p;
+
p = reader_.read("POINT(-1.233 5.678)");
ensure( p->getCoordinateDimension() == 2 );
+
+ delete p;
}
} // namespace tut
More information about the geos-commits
mailing list