Returning a naked unmanaged pointer can cause possible memory leaks
- Dominant language
- C++
- Stars
- 406
- Forks
- 134
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 24
Description
Excerpt from pr #423:
[Unrelated to the very replacement Autoptr to std::unique_ptr]
There are samples of wrong usage of `AutoPtr`/`unique_ptr`. After `.release()` and returning a naked pointer, the allocated object is left without management => memory leak possible (if no special care in the caller). Finally, using AutoPtr didn't give benefits here.
I believe this is the case for using `std::shared_ptr`, starting with function's return type.
The same approach is met in many places, so total code review for this issue.
_Originally posted by @SunFellow in https://github.com/epam/Indigo/pull/423#discussion_r650186525_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.