mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-26 01:29:59 -05:00
ITS#9952 libldap: use atexit for TLS teardown
This commit is contained in:
parent
a70f39e3aa
commit
337455eb3a
2 changed files with 13 additions and 4 deletions
|
|
@ -544,9 +544,6 @@ ldap_int_destroy_global_options(void)
|
|||
gopts->ldo_def_sasl_authcid = NULL;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_TLS
|
||||
ldap_int_tls_destroy( gopts );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -160,6 +160,14 @@ ldap_pvt_tls_destroy( void )
|
|||
tls_imp->ti_tls_destroy();
|
||||
}
|
||||
|
||||
static void
|
||||
ldap_exit_tls_destroy( void )
|
||||
{
|
||||
struct ldapoptions *lo = LDAP_INT_GLOBAL_OPT();
|
||||
|
||||
ldap_int_tls_destroy( lo );
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize a particular TLS implementation.
|
||||
* Called once per implementation.
|
||||
|
|
@ -168,6 +176,7 @@ static int
|
|||
tls_init(tls_impl *impl, int do_threads )
|
||||
{
|
||||
static int tls_initialized = 0;
|
||||
int rc;
|
||||
|
||||
if ( !tls_initialized++ ) {
|
||||
#ifdef LDAP_R_COMPILE
|
||||
|
|
@ -183,7 +192,10 @@ tls_init(tls_impl *impl, int do_threads )
|
|||
#endif
|
||||
}
|
||||
|
||||
return impl->ti_tls_init();
|
||||
rc = impl->ti_tls_init();
|
||||
|
||||
atexit( ldap_exit_tls_destroy );
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue