[opencv] 24/33: fixed memory leak in flann index
Mattia Rizzolo
mattia at debian.org
Tue Oct 4 17:51:05 UTC 2016
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to annotated tag 2.4.12.2
in repository opencv.
commit c36582d2df34ed1da9bb04393b65124e37eee497
Author: Ilya Lavrenov <ilya.lavrenov at itseez.com>
Date: Tue Sep 1 16:17:18 2015 +0300
fixed memory leak in flann index
(cherry picked from commit 32d7c1950a562d038ff6f8b810ee46298a83fc39)
---
modules/flann/src/miniflann.cpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/modules/flann/src/miniflann.cpp b/modules/flann/src/miniflann.cpp
index 5ce3e90..9bf5033 100644
--- a/modules/flann/src/miniflann.cpp
+++ b/modules/flann/src/miniflann.cpp
@@ -318,12 +318,14 @@ buildIndex_(void*& index, const Mat& wholedata, const Mat& data, const IndexPara
::cvflann::Matrix<ElementType> dataset((ElementType*)data.data, data.rows, data.cols);
- IndexType* _index = NULL;
- if( !index || getParam<flann_algorithm_t>(params, "algorithm", FLANN_INDEX_LINEAR) != FLANN_INDEX_LSH) // currently, additional index support is the lsh algorithm only.
+ // currently, additional index support is the lsh algorithm only.
+ if( !index || getParam<flann_algorithm_t>(params, "algorithm", FLANN_INDEX_LINEAR) != FLANN_INDEX_LSH)
{
- _index = new IndexType(dataset, get_params(params), dist);
+ Ptr<IndexType> _index = makePtr<IndexType>(dataset, get_params(params), dist);
_index->buildIndex();
index = _index;
+ // HACK to prevent object destruction
+ _index.obj = NULL;
}
else // build additional lsh index
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git
More information about the debian-science-commits
mailing list