From d17001072d1fdeeb44c47f30df55fcd277121be8 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Fri, 27 Nov 2020 17:03:37 -0500 Subject: [PATCH] fix(memory): Ensure RelaxNG parsing does not leak the parser context Fixes #2114 --- CHANGELOG.md | 3 ++- ext/nokogiri/xml_relax_ng.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e5fee285a2..a0a01794f59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -102,8 +102,9 @@ This release ends support for: * The switch to turn off the CSS-to-XPath cache is now thread-local, rather than being shared mutable state. [[#1935](https://github.com/sparklemotion/nokogiri/issues/1935)] * [CRuby] Fixed installation on AIX with respect to `vasprintf`. [[#1908](https://github.com/sparklemotion/nokogiri/issues/1908)] * [CRuby] On some platforms, avoid symbol name collision with glibc's `canonicalize`. [[#2105](https://github.com/sparklemotion/nokogiri/issues/2105)] -* [JRuby] Standardize reading from IO like objects, including StringIO. [[#1888](https://github.com/sparklemotion/nokogiri/issues/1888), [#1897](https://github.com/sparklemotion/nokogiri/issues/1897)] +* [CRuby] `RelaxNG.from_document` no longer leaks memory. [[#2114](https://github.com/sparklemotion/nokogiri/issues/2114)] * [Windows Visual C++] Fixed compiler warnings and errors. [[#2061](https://github.com/sparklemotion/nokogiri/issues/2061), [#2068](https://github.com/sparklemotion/nokogiri/issues/2068)] +* [JRuby] Standardize reading from IO like objects, including StringIO. [[#1888](https://github.com/sparklemotion/nokogiri/issues/1888), [#1897](https://github.com/sparklemotion/nokogiri/issues/1897)] * [JRuby] Fixed document encoding regression in v1.11.0 release candidates. [[#2080](https://github.com/sparklemotion/nokogiri/issues/2080), [#2083](https://github.com/sparklemotion/nokogiri/issues/2083)] (Thanks, [@thbar](https://github.com/thbar)!) diff --git a/ext/nokogiri/xml_relax_ng.c b/ext/nokogiri/xml_relax_ng.c index 2cb61b79f3b..9e62ff39108 100644 --- a/ext/nokogiri/xml_relax_ng.c +++ b/ext/nokogiri/xml_relax_ng.c @@ -145,7 +145,7 @@ static VALUE from_document(int argc, VALUE *argv, VALUE klass) schema = xmlRelaxNGParse(ctx); xmlSetStructuredErrorFunc(NULL, NULL); - // TODO: I've created https://github.com/sparklemotion/nokogiri/issues/2114 to clean up memory + xmlRelaxNGFreeParserCtxt(ctx); if(NULL == schema) { xmlErrorPtr error = xmlGetLastError();