raspell
raspell copied to clipboard
memory leak in aspell_list_misspelled and aspell_correct_lines
raspell contains memory leaks in list_misspelled and correct_lines due to not using rb_ensure to call delete_aspell_document_checker and free the checker. In list_misspelled, if an exception is railed from rb_yield or rb_funcall then delete_aspell_document_checker will not be called. The same is true in aspell_correct_lines.
Here is an example illustrating the leak using list_misspelled:
require 'raspell'
checker = Aspell.new 'en_US'
1_000_000.times do
begin
checker.list_misspelled %w[wraung] do
raise
end
rescue
end
end
I don't personally use Raspell anymore so mostly I curate pull requests...patches welcome!