[mlpack-git] master: Fix memory leak when dual tree search and treeOwner == true (7c01172)

gitdub at mlpack.org gitdub at mlpack.org
Wed Jul 20 17:38:59 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/0d9a0e263a32b99d8dcf5d2723b3b92c67e669fc...54c48dbd091eb4f419280a2e82ddbd1c7d438a5c

>---------------------------------------------------------------

commit 7c01172f89860c0efb907f52da2e1c85aa948d40
Author: MarcosPividori <marcos.pividori at gmail.com>
Date:   Wed Jul 20 17:57:36 2016 -0300

    Fix memory leak when dual tree search and treeOwner == true


>---------------------------------------------------------------

7c01172f89860c0efb907f52da2e1c85aa948d40
 src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp b/src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp
index 2d7468b..73560e2 100644
--- a/src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp
+++ b/src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp
@@ -361,8 +361,7 @@ Search(const MatType& querySet,
       distancePtr = new arma::mat; // Query indices need to be mapped.
       neighborPtr = new arma::Mat<size_t>;
     }
-
-    if (treeOwner)
+    else if (treeOwner)
       neighborPtr = new arma::Mat<size_t>; // Reference indices need mapping.
   }
 




More information about the mlpack-git mailing list