From e861f33b5476464baaad641ed6256469cbfc778a Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Sun, 30 Apr 2017 09:23:01 +1000 Subject: [PATCH] Fix memory leak --- tests/src/core/testqgsgeometry.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/src/core/testqgsgeometry.cpp b/tests/src/core/testqgsgeometry.cpp index d5a8aaf0595..4650a4a0ab2 100644 --- a/tests/src/core/testqgsgeometry.cpp +++ b/tests/src/core/testqgsgeometry.cpp @@ -4127,9 +4127,9 @@ void TestQgsGeometry::circle() //test conversion QgsPointSequence ptsPol; - QgsPolygonV2 *pol = new QgsPolygonV2(); + std::unique_ptr< QgsPolygonV2 > pol( new QgsPolygonV2() ); // polygon - pol = QgsCircle( QgsPointV2( 0, 0 ), 5 ).toPolygon( 4 ); + pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5 ).toPolygon( 4 ) ); QCOMPARE( pol->numInteriorRings(), 0 ); QCOMPARE( pol->exteriorRing()->numPoints(), 5 ); @@ -4144,7 +4144,7 @@ void TestQgsGeometry::circle() // oriented //45 double val = 5 * sin( M_PI / 4 ); - pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 45 ).toPolygon( 4 ); + pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 45 ).toPolygon( 4 ) ); QCOMPARE( pol->numInteriorRings(), 0 ); QCOMPARE( pol->exteriorRing()->numPoints(), 5 ); pol->exteriorRing()->points( ptsPol ); @@ -4155,7 +4155,7 @@ void TestQgsGeometry::circle() QVERIFY( ptsPol.at( 3 ) == QgsPointV2( -val, val ) ); QVERIFY( ptsPol.at( 4 ) == QgsPointV2( val, val ) ); //135 - pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 135 ).toPolygon( 4 ); + pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 135 ).toPolygon( 4 ) ); QCOMPARE( pol->numInteriorRings(), 0 ); QCOMPARE( pol->exteriorRing()->numPoints(), 5 ); pol->exteriorRing()->points( ptsPol ); @@ -4166,7 +4166,7 @@ void TestQgsGeometry::circle() QVERIFY( ptsPol.at( 3 ) == QgsPointV2( val, val ) ); QVERIFY( ptsPol.at( 4 ) == QgsPointV2( val, -val ) ); //225 - pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 225 ).toPolygon( 4 ); + pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 225 ).toPolygon( 4 ) ); QCOMPARE( pol->numInteriorRings(), 0 ); QCOMPARE( pol->exteriorRing()->numPoints(), 5 ); pol->exteriorRing()->points( ptsPol ); @@ -4177,7 +4177,7 @@ void TestQgsGeometry::circle() QVERIFY( ptsPol.at( 3 ) == QgsPointV2( val, -val ) ); QVERIFY( ptsPol.at( 4 ) == QgsPointV2( -val, -val ) ); //315 - pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 315 ).toPolygon( 4 ); + pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 315 ).toPolygon( 4 ) ); QCOMPARE( pol->numInteriorRings(), 0 ); QCOMPARE( pol->exteriorRing()->numPoints(), 5 ); pol->exteriorRing()->points( ptsPol );