open-source-parsers / open-source-parsers/jsoncpp
Change signature of newCharReader to return uniqu_ptr
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 8.9k
- Forks
- 2.7k
- Avg merge
- 31m
- Merged PRs (30d)
- 1
Description
Description
The current implementation of Json::CharReaderBuilder.newCharReader(), allocates memory, while there is no one to release it,
this issue causes a leak because when we upgraded to the new version, we didn't understand we should wrap the pointer with std::unique_ptr
Solution
Make the function return std::unique_ptr
Context
I opened that PR: https://github.com/open-source-parsers/jsoncpp/pull/1420, and that closed because it is a breaking change. While I see the point of that, I actually think that if it will break someone's code, there is a good chance that it will save him from a memory leak.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Json::CharReaderBuilder::newCharReader() and review the approach in PR 1420. Check the declaration, implementation, and callers for ownership handling; done means the function returns std::unique_ptr and the affected code builds without the reported leak.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100