From: Michał Kępień Date: Thu, 26 Sep 2019 08:20:26 +0000 (+0200) Subject: Properly initialize libxml2 X-Git-Tag: v9.14.7~13^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9f90627324362daff16acbc8288c01cf140ee56;p=thirdparty%2Fbind9.git Properly initialize libxml2 When libxml2 is to be used in a multi-threaded application, the xmlInitThreads() function must be called before any other libxml2 function. This function does different things on various platforms and thus one can get away without calling it on Unix systems, but not on Windows, where it initializes critical section objects used for synchronizing access to data structures shared between threads. Add the missing xmlInitThreads() call to prevent crashes on affected systems. Also add a matching xmlCleanupThreads() call to properly release the resources set up by xmlInitThreads(). (cherry picked from commit a3c0b00ef6b37e51e9c0075a8afffb8e1ff3398c) --- diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index 15152bafa57..b32d72f6d9e 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -3582,6 +3582,10 @@ named_statschannels_configure(named_server_t *server, const cfg_obj_t *config, ISC_LIST_INIT(new_listeners); +#ifdef HAVE_LIBXML2 + xmlInitThreads(); +#endif /* HAVE_LIBXML2 */ + /* * Get the list of named.conf 'statistics-channels' statements. */ @@ -3714,6 +3718,10 @@ named_statschannels_shutdown(named_server_t *server) { ISC_LIST_UNLINK(server->statschannels, listener, link); shutdown_listener(listener); } + +#ifdef HAVE_LIBXML2 + xmlCleanupThreads(); +#endif /* HAVE_LIBXML2 */ } isc_result_t