coin-or / Clp

COIN-OR Linear Programming Solver
Other
396 stars 82 forks source link

Memory leak in ctor of ClpNetworkMatrix #175

Closed tosttost closed 1 year ago

tosttost commented 3 years ago

In ClpNetworkMatrix.cpp line 1220:

 int *which = new int[rhs.numberRows_];

this array is never delete'd.

I'm preparing a list with similar leaks (or a PR to fix them). Is using std::unique_ptr (requires C++11) an option or should we add manual delete[] even in functions with multiple return statements? Depending on how relevant the method is for the overall performance using a pre-sized std::vector might be another alternative.