Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete incorrectly applied on some allocations from new[] #4983

Closed
david-cortes opened this issue Jan 26, 2022 · 1 comment · Fixed by #4984
Closed

delete incorrectly applied on some allocations from new[] #4983

david-cortes opened this issue Jan 26, 2022 · 1 comment · Fixed by #4984
Labels

Comments

@david-cortes
Copy link
Contributor

From #4982

The function LGBM_BoosterFreePredictSparse uses C++ operator delete to free outputs passed from the C side:

delete reinterpret_cast<int32_t*>(indptr);

These outputs are allocated with operator new[]:

*out_col_ptr = new int32_t[col_ptr_size];

Thus, it needs to use delete[], not delete, otherwise it can lead to crashes and undefined behavior.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants