Skip to content

Commit 47401f4

Browse files
authored
Merge pull request #2871 from sparklemotion/flavorjones-set-libxml-memory-management-earlier
fix: make sure libxml memory management is set early enough
2 parents 1f524a1 + 8b43c2d commit 47401f4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

ext/nokogiri/nokogiri.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ Init_nokogiri(void)
192192
mNokogiriXmlXpath = rb_define_module_under(mNokogiriXml, "XPath");
193193
mNokogiriXslt = rb_define_module_under(mNokogiri, "XSLT");
194194

195+
set_libxml_memory_management(); /* must be before any function calls that might invoke xmlInitParser() */
196+
xmlInitParser();
197+
exsltRegisterAll();
198+
195199
rb_const_set(mNokogiri, rb_intern("LIBXML_COMPILED_VERSION"), NOKOGIRI_STR_NEW2(LIBXML_DOTTED_VERSION));
196200
rb_const_set(mNokogiri, rb_intern("LIBXML_LOADED_VERSION"), NOKOGIRI_STR_NEW2(xmlParserVersion));
197201

@@ -224,11 +228,6 @@ Init_nokogiri(void)
224228
rb_const_set(mNokogiri, rb_intern("OTHER_LIBRARY_VERSIONS"), NOKOGIRI_STR_NEW2(NOKOGIRI_OTHER_LIBRARY_VERSIONS));
225229
#endif
226230

227-
set_libxml_memory_management();
228-
229-
xmlInitParser();
230-
exsltRegisterAll();
231-
232231
if (xsltExtModuleFunctionLookup((const xmlChar *)"date-time", EXSLT_DATE_NAMESPACE)) {
233232
rb_const_set(mNokogiri, rb_intern("LIBXSLT_DATETIME_ENABLED"), Qtrue);
234233
} else {

0 commit comments

Comments
 (0)