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

[bug] RelaxNG schema parsing has a small memory leak #2114

Closed
flavorjones opened this issue Nov 27, 2020 · 0 comments
Closed

[bug] RelaxNG schema parsing has a small memory leak #2114

flavorjones opened this issue Nov 27, 2020 · 0 comments
Labels
topic/memory Segfaults, memory leaks, valgrind testing, etc.
Milestone

Comments

@flavorjones
Copy link
Member

Please describe the bug

When parsing a RelaxNG schema, the schema context is not freed, resulting in leaked memory.

Help us reproduce what you're seeing

#! /usr/bin/env ruby

require "nokogiri"

loop do
  Nokogiri::XML::RelaxNG.from_document(Nokogiri::XML::Document.parse(File.read("/home/flavorjones/code/oss/nokogiri/test/files/address_book.rlx")))
end

Expected behavior

No memory should be leaked.

Additional context

I believe we just need to add a call to xmlRelaxNGFreeParserCtxt(ctx); in both read_memory and from_document in xml_relax_ng.c

@flavorjones flavorjones added topic/memory Segfaults, memory leaks, valgrind testing, etc. state/needs-triage Inbox for non-installation-related bug reports or help requests and removed state/needs-triage Inbox for non-installation-related bug reports or help requests labels Nov 27, 2020
@flavorjones flavorjones added this to the v1.11.0 milestone Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/memory Segfaults, memory leaks, valgrind testing, etc.
Projects
None yet
Development

No branches or pull requests

1 participant