Skip to content
Snippets Groups Projects
Commit a1f81528 authored by Éric Béchet's avatar Éric Béchet
Browse files

fixed memory leak in assignement

parent e0aa90a7
No related branches found
No related tags found
No related merge requests found
......@@ -97,8 +97,14 @@ class fullMatrix
if(this != &other){
_r = other._r;
_c = other._c;
_data = new scalar[_r * _c];
for(int i = 0; i < _r * _c; ++i) _data[i] = other._data[i];
if (_data) delete[] _data;
if ((_r==0)||(_c==0))
_data=0;
else
{
_data = new scalar[_r * _c];
for(int i = 0; i < _r * _c; ++i) _data[i] = other._data[i];
}
}
return *this;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment