[mlpack-git] mlpack-2.0.x: Fix memory leak when dual tree search and treeOwner == true (96b536b)

gitdub at mlpack.org gitdub at mlpack.org
Wed Jul 20 19:28:19 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : mlpack-2.0.x
Link       : https://github.com/mlpack/mlpack/compare/fc4195d27bb9e642356a384d1fa6fe10cbdf89a6...715c474599e71bb47899a4b6eb3ec5582650d7f9

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

commit 96b536b8911eaf2cd29c21e9c2a404d78f7fc972
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


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

96b536b8911eaf2cd29c21e9c2a404d78f7fc972
 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 cba373f..18a1e52 100644
--- a/src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp
+++ b/src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp
@@ -355,8 +355,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