From 64884e7c6c25b5ad16f1c944a412533eae0c4fb5 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 25 Feb 2009 10:14:00 +0000 Subject: [PATCH] Don't call NSS_Shutdown if someone else init'd the library --- libraries/libldap/tls_m.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libraries/libldap/tls_m.c b/libraries/libldap/tls_m.c index 93ab4ae0c6..bd9fdcdc44 100644 --- a/libraries/libldap/tls_m.c +++ b/libraries/libldap/tls_m.c @@ -61,6 +61,8 @@ static const PRIOMethods tlsm_PR_methods; extern tls_impl ldap_int_tls_impl; +static int tslm_did_init; + #ifdef LDAP_R_COMPILE static void @@ -81,6 +83,8 @@ tlsm_init( void ) tlsm_layer_id = PR_GetUniqueIdentity("OpenLDAP"); if ( !NSS_IsInitialized() ) { + tlsm_did_init = 1; + NSS_NoDB_Init(""); NSS_SetDomesticPolicy(); @@ -97,7 +101,12 @@ tlsm_init( void ) static void tlsm_destroy( void ) { - NSS_Shutdown(); + /* Only if we did the actual initialization */ + if ( tlsm_did_init ) { + tlsm_did_init = 0; + + NSS_Shutdown(); + } PR_Cleanup(); } -- 2.39.5