From bc221bdb908052b0f58de388d73885c94654f2ee Mon Sep 17 00:00:00 2001
From: Pierre-Emmanuel Viel
Date: Sun, 2 Aug 2020 18:05:20 +0200
Subject: [PATCH] Cleaner code for hierarchical_clustering
---
.../flann/hierarchical_clustering_index.h | 39 ++++++++-----------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/modules/flann/include/opencv2/flann/hierarchical_clustering_index.h b/modules/flann/include/opencv2/flann/hierarchical_clustering_index.h
index c068e184bb..78ac401630 100644
--- a/modules/flann/include/opencv2/flann/hierarchical_clustering_index.h
+++ b/modules/flann/include/opencv2/flann/hierarchical_clustering_index.h
@@ -404,34 +404,16 @@ public:
*/
virtual ~HierarchicalClusteringIndex()
{
- free_elements();
-
if (root!=NULL) {
delete[] root;
}
if (indices!=NULL) {
+ free_indices();
delete[] indices;
}
}
-
- /**
- * Release the inner elements of indices[]
- */
- void free_elements()
- {
- if (indices!=NULL) {
- for(int i=0; i