Skip to content

Commit

Permalink
Fixed a bug where osqpData->defines would be freed twice
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitSolomonPrinceton committed Feb 20, 2024
1 parent fcc4055 commit a7a5e89
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions c_sources/osqp_mex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
char cmd[CMD_MAX_LEN];

setString(nrhs, prhs, 0, cmd, CMD_MAX_LEN);

/*
* First check to see if a new object was requested
*/
Expand Down Expand Up @@ -253,9 +253,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])

// delete the object and its data
if (!strcmp("delete", cmd)) {

osqp_cleanup(osqpData->solver);
if (osqpData->defines) c_free(osqpData->defines);
destroyObject<OsqpData>(prhs[1]);
// Warn if other commands were ignored
if (nlhs != 0 || nrhs != 2)
Expand Down

0 comments on commit a7a5e89

Please sign in to comment.