From: Howard Chu Date: Fri, 7 Apr 2006 01:15:56 +0000 (+0000) Subject: Free/decrement SSL_CTX refcount when (re)setting it X-Git-Tag: OPENLDAP_REL_ENG_2_4_0ALPHA~21 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9693c800bfb91766402b3ceba765dfa6a369551f;p=openldap Free/decrement SSL_CTX refcount when (re)setting it --- diff --git a/libraries/libldap/tls.c b/libraries/libldap/tls.c index 6bf4fd3c88..96e57ef951 100644 --- a/libraries/libldap/tls.c +++ b/libraries/libldap/tls.c @@ -1347,6 +1347,8 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg ) return -1; case LDAP_OPT_X_TLS_CTX: + if ( lo->ldo_tls_ctx ) + SSL_CTX_free( lo->ldo_tls_ctx ); lo->ldo_tls_ctx = arg; return 0; case LDAP_OPT_X_TLS_CONNECT_CB: @@ -1413,6 +1415,8 @@ ldap_pvt_tls_set_option( LDAP *ld, int option, void *arg ) case LDAP_OPT_X_TLS_NEWCTX: if ( !arg ) return -1; + if ( lo->ldo_tls_ctx ) + SSL_CTX_free( lo->ldo_tls_ctx ); lo->ldo_tls_ctx = NULL; return ldap_int_tls_init_ctx( lo, *(int *)arg ); default: