Merge pull request #810 from iwilkes1/master

Fixed mismatched new and delete in BussIK VectorRn and MatrixRmn
This commit is contained in:
erwincoumans
2016-09-28 17:20:40 -07:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

@@ -181,7 +181,7 @@ inline MatrixRmn::MatrixRmn( long numRows, long numCols )
inline MatrixRmn::~MatrixRmn() inline MatrixRmn::~MatrixRmn()
{ {
delete x; delete[] x;
} }
// Resize. // Resize.
@@ -191,7 +191,7 @@ inline void MatrixRmn::SetSize( long numRows, long numCols )
assert ( numRows>0 && numCols>0 ); assert ( numRows>0 && numCols>0 );
long newLength = numRows*numCols; long newLength = numRows*numCols;
if ( newLength>AllocSize ) { if ( newLength>AllocSize ) {
delete x; delete[] x;
AllocSize = Max(newLength, AllocSize<<1); AllocSize = Max(newLength, AllocSize<<1);
x = new double[AllocSize]; x = new double[AllocSize];
} }

View File

@@ -104,7 +104,7 @@ inline VectorRn::VectorRn( long initLength )
inline VectorRn::~VectorRn() inline VectorRn::~VectorRn()
{ {
delete x; delete[] x;
} }
// Resize. // Resize.
@@ -113,7 +113,7 @@ inline void VectorRn::SetLength( long newLength )
{ {
assert ( newLength>0 ); assert ( newLength>0 );
if ( newLength>AllocLength ) { if ( newLength>AllocLength ) {
delete x; delete[] x;
AllocLength = Max( newLength, AllocLength<<1 ); AllocLength = Max( newLength, AllocLength<<1 );
x = new double[AllocLength]; x = new double[AllocLength];
} }