From 5aec94c07e7afa7b8d3f94bb676eff8f4f97a048 Mon Sep 17 00:00:00 2001 From: Levi Armstrong Date: Fri, 12 Apr 2024 21:23:23 -0500 Subject: [PATCH] Mismatched free fix (#399) Co-authored-by: Jack-ReframeSystems --- trajopt_sco/include/trajopt_sco/osqp_interface.hpp | 12 ++++++------ trajopt_sco/src/osqp_interface.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/trajopt_sco/include/trajopt_sco/osqp_interface.hpp b/trajopt_sco/include/trajopt_sco/osqp_interface.hpp index 49fb9902..fada8afc 100644 --- a/trajopt_sco/include/trajopt_sco/osqp_interface.hpp +++ b/trajopt_sco/include/trajopt_sco/osqp_interface.hpp @@ -60,12 +60,12 @@ class OSQPModel : public Model ConstraintTypeVector cnt_types_; /**< constraints types */ DblVec solution_; /**< optimizizer's solution for current model */ - std::unique_ptr P_; /**< Takes ownership of OSQPData.P to avoid having to deallocate manually */ - std::unique_ptr A_; /**< Takes ownership of OSQPData.A to avoid having to deallocate manually */ - std::vector P_row_indices_; /**< row indices for P, CSC format */ - std::vector P_column_pointers_; /**< column pointers for P, CSC format */ - DblVec P_csc_data_; /**< P values in CSC format */ - Eigen::VectorXd q_; /**< linear part of the objective */ + std::unique_ptr P_; /**< Takes ownership of OSQPData.P to avoid having to deallocate manually */ + std::unique_ptr A_; /**< Takes ownership of OSQPData.A to avoid having to deallocate manually */ + std::vector P_row_indices_; /**< row indices for P, CSC format */ + std::vector P_column_pointers_; /**< column pointers for P, CSC format */ + DblVec P_csc_data_; /**< P values in CSC format */ + Eigen::VectorXd q_; /**< linear part of the objective */ std::vector A_row_indices_; /**< row indices for constraint matrix, CSC format */ std::vector A_column_pointers_; /**< column pointers for constraint matrix, CSC format */ diff --git a/trajopt_sco/src/osqp_interface.cpp b/trajopt_sco/src/osqp_interface.cpp index cdd9b242..24b6cd62 100644 --- a/trajopt_sco/src/osqp_interface.cpp +++ b/trajopt_sco/src/osqp_interface.cpp @@ -36,7 +36,7 @@ Model::Ptr createOSQPModel(const ModelConfig::ConstPtr& config = nullptr) return std::make_shared(config); } -OSQPModel::OSQPModel(const ModelConfig::ConstPtr& config) : P_(nullptr), A_(nullptr) +OSQPModel::OSQPModel(const ModelConfig::ConstPtr& config) : P_(nullptr, free), A_(nullptr, free) { // tuning parameters to be less accurate, but add a polishing step if (config != nullptr)