]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/init.c
fix previous commit (ITS#4861)
[openldap] / servers / slapd / init.c
index 6a68e498eec835b3128163c3f5bb387582ebcedc..9a048b64eb5417f0a0095d7569cee92ae1b55962 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -137,7 +137,6 @@ slap_init( int mode, const char *name )
 
                ldap_pvt_thread_pool_init( &connection_pool,
                                connection_pool_max, 0);
-
                ldap_pvt_thread_mutex_init( &entry2str_mutex );
                ldap_pvt_thread_mutex_init( &replog_mutex );
 
@@ -172,6 +171,8 @@ slap_init( int mode, const char *name )
                if( rc == 0 ) {
                        rc = backend_init( );
                }
+               if ( rc )
+                       return rc;
 
                break;
 
@@ -299,6 +300,9 @@ int slap_destroy(void)
                ber_bvarray_free( default_referral );
        }
 
+       /* clear out any thread-keys for the main thread */
+       ldap_pvt_thread_pool_context_reset( ldap_pvt_thread_pool_context());
+
        rc = backend_destroy();
 
        slap_sasl_destroy();