Commit f7d36bba authored by Ilya Lavrenov's avatar Ilya Lavrenov Committed by Dikay900

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

parent d81a0df4
......@@ -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()
{
if (index)
{
delete index;
index = NULL;
}
}
//---------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment