Skip to content

Commit

Permalink
Issue #1163: Bugfix qpOASES (2)
Browse files Browse the repository at this point in the history
Removed qpOASES::Matrix::free completely
  • Loading branch information
jaeandersson committed Jan 25, 2016
1 parent 43da272 commit 18f8e49
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 44 deletions.
9 changes: 0 additions & 9 deletions external_packages/qpOASES/include/qpOASES/Matrices.hpp
Expand Up @@ -392,9 +392,6 @@ class DenseMatrix : public virtual Matrix
/** Destructor. */
virtual ~DenseMatrix( );

/** Frees all internal memory. */
void free( );

/** Returns a deep-copy of the Matrix object.
* \return Deep-copy of Matrix object */
virtual Matrix *duplicate( ) const;
Expand Down Expand Up @@ -620,9 +617,6 @@ class SparseMatrix : public virtual Matrix
/** Destructor. */
virtual ~SparseMatrix( );

/** Frees all internal memory. */
void free( );

/** Returns a deep-copy of the Matrix object.
* \return Deep-copy of Matrix object */
virtual Matrix *duplicate( ) const;
Expand Down Expand Up @@ -800,9 +794,6 @@ class SparseMatrixRow : public virtual Matrix
/** Destructor. */
virtual ~SparseMatrixRow( );

/** Frees all internal memory. */
void free( );

/** Returns a deep-copy of the Matrix object.
* \return Deep-copy of Matrix object */
virtual Matrix *duplicate( ) const;
Expand Down
59 changes: 24 additions & 35 deletions external_packages/qpOASES/src/Matrices.cpp
Expand Up @@ -100,14 +100,11 @@ returnValue Matrix::getSparseSubmatrix(
DenseMatrix::~DenseMatrix()
{
if ( needToFreeMemory( ) == BT_TRUE )
free( );
}

void DenseMatrix::free( )
{
if (val != 0)
{
if (val != 0)
delete[] val;
val = 0;
val = 0;
}
}

Matrix *DenseMatrix::duplicate( ) const
Expand Down Expand Up @@ -697,20 +694,16 @@ SparseMatrix::~SparseMatrix()
}

if ( needToFreeMemory() == BT_TRUE )
free( );
}


void SparseMatrix::free( )
{
if (ir != 0) delete[] ir;
ir = 0;
if (jc != 0) delete[] jc;
jc = 0;
if (val != 0) delete[] val;
val = 0;

doNotFreeMemory( );
{
if (ir != 0) delete[] ir;
ir = 0;
if (jc != 0) delete[] jc;
jc = 0;
if (val != 0) delete[] val;
val = 0;

doNotFreeMemory( );
}
}

Matrix *SparseMatrix::duplicate() const
Expand Down Expand Up @@ -1410,20 +1403,16 @@ SparseMatrixRow::~SparseMatrixRow()
}

if ( needToFreeMemory() == BT_TRUE )
free( );
}


void SparseMatrixRow::free( )
{
if (jr != 0) delete[] jr;
jr = 0;
if (ic != 0) delete[] ic;
ic = 0;
if (val != 0) delete[] val;
val = 0;

doNotFreeMemory( );
{
if (jr != 0) delete[] jr;
jr = 0;
if (ic != 0) delete[] ic;
ic = 0;
if (val != 0) delete[] val;
val = 0;

doNotFreeMemory( );
}
}


Expand Down

0 comments on commit 18f8e49

Please sign in to comment.