apollo
apollo copied to clipboard
memory leak in modules/planning/math/piecewise_jerk/piecewise_jerk_problem.cc
Describe the bug
OSQPData* data = reinterpret_cast<OSQPData*>(c_malloc(sizeof(OSQPData)));
This variable data was never freed. The csc_matrixies was never freed neither.
void PiecewiseJerkProblem::FreeData(OSQPData* data) {
delete[] data->q;
delete[] data->l;
delete[] data->u;
delete[] data->P->i;
delete[] data->P->p;
delete[] data->P->x;
c_free(data->P);
delete[] data->A->i;
delete[] data->A->p;
delete[] data->A->x;
c_free(data->A);
c_free(data);
}
may fix this bug.
To Reproduce
You can use address sanitizer to examine the leaking.
I've started a pull request to fix a fd leak in https://github.com/ApolloAuto/apollo/pull/14309 , but no one cares my fixing. So I lost my patient on testing the fixing uppon. And just report the bug here - -, to fix or not, it's your decision.
maybe you have helped me to solve the coredump problem,according to your tips.
Thanks for your pr, maybe you have solved the bug, could you add a new pr to fix it.We will merge into master