From 8c1278a7a13a5d9694ef5170db825282af16c59a Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Thu, 12 Jul 2018 12:22:18 +0200 Subject: [PATCH] fix memory leaks in pytensor constructor and copy constructor --- include/xtensor-python/pytensor.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/xtensor-python/pytensor.hpp b/include/xtensor-python/pytensor.hpp index 0b73012..1d38307 100644 --- a/include/xtensor-python/pytensor.hpp +++ b/include/xtensor-python/pytensor.hpp @@ -342,7 +342,7 @@ namespace xt */ template inline pytensor::pytensor(const self_type& rhs) - : self_type() + : base_type(), semantic_base(rhs) { init_tensor(rhs.shape(), rhs.strides()); std::copy(rhs.storage().cbegin(), rhs.storage().cend(), this->storage().begin()); @@ -416,7 +416,7 @@ namespace xt auto dtype = pybind11::detail::npy_format_descriptor::dtype(); auto tmp = pybind11::reinterpret_steal( - PyArray_NewFromDescr(&PyArray_Type, (PyArray_Descr*) dtype.ptr(), static_cast(shape.size()), + PyArray_NewFromDescr(&PyArray_Type, (PyArray_Descr*) dtype.release().ptr(), static_cast(shape.size()), const_cast(shape.data()), python_strides, nullptr, flags, nullptr));