Commit bcc90106 authored by Ilya Lavrenov's avatar Ilya Lavrenov

fixed memory leak in flann tests

parent 02aabcca
......@@ -318,7 +318,19 @@ buildIndex_(void*& index, const Mat& data, const IndexParams& params, const Dist
::cvflann::Matrix<ElementType> dataset((ElementType*)data.data, data.rows, data.cols);
IndexType* _index = new IndexType(dataset, get_params(params), dist);
_index->buildIndex();
try
{
_index->buildIndex();
}
catch (...)
{
delete _index;
_index = NULL;
throw;
}
index = _index;
}
......
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