mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
Use library constructor/destructor to initialize OpenSSL
Instead of calling isc_tls_initialize()/isc_tls_destroy() explicitly use gcc/clang attributes on POSIX and DLLMain on Windows to initialize and shutdown OpenSSL library. This resolves the issue when isc_nm_create() / isc_nm_destroy() was called multiple times and it would call OpenSSL library destructors from isc_nm_destroy(). At the same time, since we now have introduced the ctor/dtor for libisc, this commit moves the isc_mem API initialization (the list of the contexts) and changes the isc_mem_checkdestroyed() to schedule the checking of memory context on library unload instead of executing the code immediately.
This commit is contained in:
@@ -13,6 +13,12 @@
|
||||
|
||||
#include <isc/bind9.h>
|
||||
#include <isc/lib.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/tls.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include "mem_p.h"
|
||||
#include "tls_p.h"
|
||||
|
||||
/***
|
||||
*** Functions
|
||||
@@ -22,3 +28,20 @@ void
|
||||
isc_lib_register(void) {
|
||||
isc_bind9 = false;
|
||||
}
|
||||
|
||||
void
|
||||
isc__initialize(void) ISC_CONSTRUCTOR(101);
|
||||
void
|
||||
isc__shutdown(void) ISC_DESTRUCTOR(101);
|
||||
|
||||
void
|
||||
isc__initialize(void) {
|
||||
isc__mem_initialize();
|
||||
isc__tls_initialize();
|
||||
}
|
||||
|
||||
void
|
||||
isc__shutdown(void) {
|
||||
isc__tls_shutdown();
|
||||
isc__mem_shutdown();
|
||||
}
|
||||
|
Reference in New Issue
Block a user