Commit 4d59cc62 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts

python bindings : remove 2 memory leaks

parent 9d48ef6e
......@@ -73,7 +73,10 @@
ParticleToMesh(len, (double*)PyArray_DATA(p), PyArray_DIMS(e)[0], (size_t*)PyArray_DATA(e), (size_t*)PyArray_DATA(elid), (double*)PyArray_DATA(xi));
Py_DECREF(e);
Py_DECREF(p);
return PyTuple_Pack(2, (PyObject*) elid, (PyObject*) xi);
PyObject *r = PyTuple_Pack(2, (PyObject*) elid, (PyObject*) xi);
Py_DECREF(xi);
Py_DECREF(elid);
return r;
}
%}
......@@ -94,6 +97,9 @@ struct ParticleProblem{};
self->_this = particleProblemNew();
return self;
}
~ParticleProblem() {
particleProblemDelete($self->_this);
}
void addParticle(const double x[DIMENSION], double r, double m) { particleProblemAddParticle($self->_this, x, r, m); }
size_t addBoundaryDisk(const double x0[DIMENSION], double r, int tag) {return particleProblemAddBoundaryDisk($self->_this, x0, r, tag);}
size_t addBoundarySegment(const double x0[DIMENSION], const double x1[DIMENSION], int tag) {return particleProblemAddBoundarySegment($self->_this, x0, x1, tag);}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment