-
-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG: Avoid
Py_buffer
memory leaks, using unique_ptr
as scope guard
The original implementations of `PyBuffer::_GetImageViewFromArray`, `PyVectorContainer::_vector_container_from_array`, `PyVnl::_GetVnlVectorFromArray`, and `PyVnl<TElement>::_GetVnlMatrixFromArray` might leak memory from `Py_buffer` in case of an exception. This commit avoids such leaks by replacing the manual `PyBuffer_Release(&pyBuffer)` calls in those member functions with scope guards.
- Loading branch information
Showing
3 changed files
with
15 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters