[mlpack-git] master: Fix memory leak and bug. (6caf31a)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Mon May 4 13:39:18 EDT 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/b9d571606ded7e6261682ce4eddca40aa3015cc3...6caf31a493719a3a5edf2fdcde9b0eef9e165944

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

commit 6caf31a493719a3a5edf2fdcde9b0eef9e165944
Author: Ryan Curtin <ryan at ratml.org>
Date:   Mon May 4 11:36:13 2015 -0400

    Fix memory leak and bug.


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

6caf31a493719a3a5edf2fdcde9b0eef9e165944
 src/mlpack/core/tree/binary_space_tree/mean_split_impl.hpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mlpack/core/tree/binary_space_tree/mean_split_impl.hpp b/src/mlpack/core/tree/binary_space_tree/mean_split_impl.hpp
index 3d72938..94d297d 100644
--- a/src/mlpack/core/tree/binary_space_tree/mean_split_impl.hpp
+++ b/src/mlpack/core/tree/binary_space_tree/mean_split_impl.hpp
@@ -58,14 +58,15 @@ bool MeanSplit<BoundType, MatType>::SplitNode(const BoundType& bound,
     // Now, which is the widest?
     for (size_t d = 0; d < data.n_rows; d++)
     {
-      const double width = bound[d].Width();
-
+      const double width = ranges[d].Width();
       if (width > maxWidth)
       {
         maxWidth = width;
         splitDimension = d;
       }
     }
+
+    delete[] ranges;
   }
 
   if (maxWidth == 0) // All these points are the same.  We can't split.



More information about the mlpack-git mailing list