Skip to content

Commit e861f33

Browse files
committed
Fix memory leak
1 parent 8593f3a commit e861f33

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/src/core/testqgsgeometry.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -4127,9 +4127,9 @@ void TestQgsGeometry::circle()
41274127

41284128
//test conversion
41294129
QgsPointSequence ptsPol;
4130-
QgsPolygonV2 *pol = new QgsPolygonV2();
4130+
std::unique_ptr< QgsPolygonV2 > pol( new QgsPolygonV2() );
41314131
// polygon
4132-
pol = QgsCircle( QgsPointV2( 0, 0 ), 5 ).toPolygon( 4 );
4132+
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5 ).toPolygon( 4 ) );
41334133
QCOMPARE( pol->numInteriorRings(), 0 );
41344134
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
41354135

@@ -4144,7 +4144,7 @@ void TestQgsGeometry::circle()
41444144
// oriented
41454145
//45
41464146
double val = 5 * sin( M_PI / 4 );
4147-
pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 45 ).toPolygon( 4 );
4147+
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 45 ).toPolygon( 4 ) );
41484148
QCOMPARE( pol->numInteriorRings(), 0 );
41494149
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
41504150
pol->exteriorRing()->points( ptsPol );
@@ -4155,7 +4155,7 @@ void TestQgsGeometry::circle()
41554155
QVERIFY( ptsPol.at( 3 ) == QgsPointV2( -val, val ) );
41564156
QVERIFY( ptsPol.at( 4 ) == QgsPointV2( val, val ) );
41574157
//135
4158-
pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 135 ).toPolygon( 4 );
4158+
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 135 ).toPolygon( 4 ) );
41594159
QCOMPARE( pol->numInteriorRings(), 0 );
41604160
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
41614161
pol->exteriorRing()->points( ptsPol );
@@ -4166,7 +4166,7 @@ void TestQgsGeometry::circle()
41664166
QVERIFY( ptsPol.at( 3 ) == QgsPointV2( val, val ) );
41674167
QVERIFY( ptsPol.at( 4 ) == QgsPointV2( val, -val ) );
41684168
//225
4169-
pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 225 ).toPolygon( 4 );
4169+
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 225 ).toPolygon( 4 ) );
41704170
QCOMPARE( pol->numInteriorRings(), 0 );
41714171
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
41724172
pol->exteriorRing()->points( ptsPol );
@@ -4177,7 +4177,7 @@ void TestQgsGeometry::circle()
41774177
QVERIFY( ptsPol.at( 3 ) == QgsPointV2( val, -val ) );
41784178
QVERIFY( ptsPol.at( 4 ) == QgsPointV2( -val, -val ) );
41794179
//315
4180-
pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 315 ).toPolygon( 4 );
4180+
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 315 ).toPolygon( 4 ) );
41814181
QCOMPARE( pol->numInteriorRings(), 0 );
41824182
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
41834183
pol->exteriorRing()->points( ptsPol );

0 commit comments

Comments
 (0)