Skip to content

Commit

Permalink
fixed memory leak in flann tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov committed Jul 12, 2016
1 parent 02aabcc commit bcc9010
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion modules/flann/src/miniflann.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit bcc9010

Please sign in to comment.