[kernel] avoid double free on _numericsMatrix->matrix0 (correction)
@@ -382,10 +382,11 @@ SimpleMatrix::~SimpleMatrix()
if(_num == Siconos::DENSE)
{
delete(mat.Dense);
- if (_numericsMatrix->matrix0)
+ if (_numericsMatrix)
{
// _numericsMatrix->matrix0 points to the array contained in the ublas matrix
// To avoid double free on this pointer, we set it to NULL before deletion
+ if (_numericsMatrix->matrix0)
_numericsMatrix->matrix0 =NULL;
}
}
