Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example wrappers leak memory #544

Closed
nwellnhof opened this issue Apr 11, 2024 · 2 comments · Fixed by #546
Closed

Example wrappers leak memory #544

nwellnhof opened this issue Apr 11, 2024 · 2 comments · Fixed by #546

Comments

@nwellnhof
Copy link
Contributor

The Python, Ruby and PHP wrappers leak memory. The C string returned from cmark_markdown_to_html must be freed (by calling free) after converting to a host language string. I recently fixed this for cmark.py in dfad5a9.

@jgm
Copy link
Member

jgm commented Apr 11, 2024

Good point. I don't have time (or perhaps expertise) to fix these, but it would be great if someone could. Otherwise I'd suggest adding comments to them indicating that they are just simple examples and don't free memory, and perhaps linking to cmark.py in cmark for a more solid example?

@CViniciusSDias
Copy link
Contributor

PHP frees it's memory automatically when the pointer goes out of scope, so there is no memory leak.
But just to keep the examples consistent, I created the following PR:
#545

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants