]> git.sur5r.net Git - openldap/commitdiff
Fix destruct sequencing
authorHoward Chu <hyc@openldap.org>
Fri, 7 Apr 2006 02:41:58 +0000 (02:41 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 7 Apr 2006 02:41:58 +0000 (02:41 +0000)
libraries/libldap/tls.c

index 96e57ef95150fa648ec0f2aca9ac85fcff4486fd..504263ed14d3df89323f441daa95596dc9ba1d8a 100644 (file)
@@ -111,8 +111,10 @@ static void tls_init_threads( void )
 void
 ldap_int_tls_destroy( struct ldapoptions *lo )
 {
-       SSL_CTX_free( lo->ldo_tls_ctx );
-       lo->ldo_tls_ctx = NULL;
+       if ( lo->ldo_tls_ctx ) {
+               SSL_CTX_free( lo->ldo_tls_ctx );
+               lo->ldo_tls_ctx = NULL;
+       }
 
        if ( lo->ldo_tls_certfile ) {
                LDAP_FREE( lo->ldo_tls_certfile );
@@ -146,6 +148,10 @@ ldap_int_tls_destroy( struct ldapoptions *lo )
 void
 ldap_pvt_tls_destroy( void )
 {
+       struct ldapoptions *lo = LDAP_INT_GLOBAL_OPT();   
+
+       ldap_int_tls_destroy( lo );
+
        EVP_cleanup();
        ERR_remove_state(0);
        ERR_free_strings();