Example wrappers leak memory
Closed this issue · 2 comments
nwellnhof commented
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 commented
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 commented
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