epam / epam/Indigo

Returning a naked unmanaged pointer can cause possible memory leaks

Open
#443 0 comments 0 reactions 0 assignees View on GitHub
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.