fixed memory leaks in modules/features2d/test/test_nearestneighbors.cpp

pull/5335/head
Ilya Lavrenov 9 years ago committed by Dikay900
parent d81a0df489
commit f7d36bbad5
  1. 11
      modules/features2d/test/test_nearestneighbors.cpp

@ -161,7 +161,7 @@ void NearestNeighborTest::run( int /*start_from*/ ) {
class CV_FlannTest : public NearestNeighborTest
{
public:
CV_FlannTest() {}
CV_FlannTest() : NearestNeighborTest(), index(NULL) { }
protected:
void createIndex( const Mat& data, const IndexParams& params );
int knnSearch( Mat& points, Mat& neighbors );
@ -172,6 +172,9 @@ protected:
void CV_FlannTest::createIndex( const Mat& data, const IndexParams& params )
{
// release previously allocated index
releaseModel();
index = new Index( data, params );
}
@ -238,7 +241,11 @@ int CV_FlannTest::radiusSearch( Mat& points, Mat& neighbors )
void CV_FlannTest::releaseModel()
{
delete index;
if (index)
{
delete index;
index = NULL;
}
}
//---------------------------------------

Loading…
Cancel
Save