Skip to content
Snippets Groups Projects
Unverified Commit c2608e84 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #140 from jcarpent/devel

Fix potential memory leak issue
parents 17400308 5ab1f167
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,17 @@
#include "eigenpy/registration.hpp"
#include "eigenpy/map.hpp"
namespace boost { namespace python { namespace detail {
template<class MatType>
struct referent_size<Eigen::MatrixBase<MatType>&>
{
BOOST_STATIC_CONSTANT(
std::size_t, value = sizeof(MatType));
};
}}}
namespace boost { namespace python { namespace converter {
template<class MatType>
......@@ -67,7 +78,8 @@ struct implicit<MatType,Eigen::MatrixBase<MatType> >
static void construct(PyObject* obj, rvalue_from_python_stage1_data* data)
{
void* storage = ((rvalue_from_python_storage<Source>*)data)->storage.bytes;
void* storage = reinterpret_cast<rvalue_from_python_storage<Target>*>
(reinterpret_cast<void*>(data))->storage.bytes;
arg_from_python<Source> get_source(obj);
bool convertible = get_source.convertible();
......@@ -565,8 +577,8 @@ namespace eigenpy
PyArrayObject * pyArray = reinterpret_cast<PyArrayObject*>(pyObj);
assert((PyArray_DIMS(pyArray)[0]<INT_MAX) && (PyArray_DIMS(pyArray)[1]<INT_MAX));
void* storage = ((bp::converter::rvalue_from_python_storage<MatType>*)
((void*)memory))->storage.bytes;
void* storage = reinterpret_cast<bp::converter::rvalue_from_python_storage<MatType>*>
(reinterpret_cast<void*>(memory))->storage.bytes;
EigenObjectAllocator<MatType>::allocate(pyArray,storage);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment