Skip to content

Commit fedbf09

Browse files
author
Benjamin Chrétien
committed
Make sure constraintJacobians_ is empty before calling push_back
1 parent e90f095 commit fedbf09

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/tnlp.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,12 @@ namespace roboptim
104104
(logger, "Looking for non-zeros elements.");
105105
LOG4CXX_TRACE (logger, "nele_jac = " << nele_jac);
106106

107+
// Clear just in case
108+
constraintJacobians_.clear ();
109+
107110
// Emptying iRow/jCol arrays.
108-
memset (iRow, 0, static_cast<std::size_t> (nele_jac) * sizeof (Index));
109-
memset (jCol, 0, static_cast<std::size_t> (nele_jac) * sizeof (Index));
111+
std::memset (iRow, 0, static_cast<std::size_t> (nele_jac) * sizeof (Index));
112+
std::memset (jCol, 0, static_cast<std::size_t> (nele_jac) * sizeof (Index));
110113

111114
// First evaluate the constraints in zero to build the
112115
// constraints jacobian.

0 commit comments

Comments
 (0)