Potential Memory Leak
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
In `src/constants.c`, if the `PyNumber_And` call fails, the routine returns without disposing of allocated objects.
[Enclosed](https://github.com/matplotlib/fcpy/files/1291248/ldo-memleak-patch-20170911.txt) is a patch that fixes this, while regularizing the handling of cleanup on errors in an easier-to-understand, more structured fashion, avoiding `goto`s. Even with explicitly spelling out `PyErr_Occurred()` calls everywhere, the code is still slightly shorter.
But I think a C extension library requires too much work for this kind of thing. A more complete binding for Fontconfig can be done in pure Python with [much less code](https://github.com/ldo/python_fontconfig).
Contributor guide
No contributing guide indexed for this repository
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 by reading src/constants.c and comparing its PyNumber_And failure path with the attached patch. Confirm that allocated objects are disposed of on that failure and that the error cleanup paths are handled consistently; completion is a leak-free routine on those error paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100