[mlpack-git] [mlpack/mlpack] Hilbert R tree (#664)

Ryan Curtin notifications at github.com
Mon Jun 20 17:42:41 EDT 2016


> +    ownsLocalDataset = true;
> +  }
> +    
> +  if (ownsLocalDataset)
> +  {
> +    localDataset =  new arma::Mat<HilbertElemType>(tree->Dataset().n_rows,
> +                                            tree->MaxLeafSize() + 1);
> +  }
> +
> +}
> +
> +template<typename TreeElemType>
> +DiscreteHilbertValue<TreeElemType>::
> +DiscreteHilbertValue(const DiscreteHilbertValue& other) :
> +    localDataset(const_cast<arma::Mat<HilbertElemType>*>(other.LocalDataset())),
> +    ownsLocalDataset(other.ownsLocalDataset),

I think that I could cause an invalid delete if I did this:

```
{
  DiscreteHilbertValue a(someNode); // someNode should be the root
  DiscreteHilbertValue b(a); // Calls this copy constructor.
} // When b's destructor is called, a.localDataset is freed a second time
```

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/664/files/f9127cea62d5ce1ad8d5f59931de108a2f7cdd9b#r67772247
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160620/5153ebc5/attachment.html>


More information about the mlpack-git mailing list