mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-18 11:05:48 +08:00
Avoid premature free
This commit is contained in:
parent
9287252162
commit
6aadd51861
@ -329,9 +329,16 @@ ldap_int_open_connection(
|
||||
if (ld->ld_options.ldo_tls_mode == LDAP_OPT_X_TLS_HARD ||
|
||||
strcmp( srv->lud_scheme, "ldaps" ) == 0 )
|
||||
{
|
||||
LDAPConn *savedefconn = ld->ld_defconn;
|
||||
++conn->lconn_refcnt; /* avoid premature free */
|
||||
ld->ld_defconn = conn;
|
||||
|
||||
rc = ldap_pvt_tls_start( ld, conn->lconn_sb,
|
||||
ld->ld_options.ldo_tls_ctx );
|
||||
|
||||
ld->ld_defconn = savedefconn;
|
||||
--conn->lconn_refcnt;
|
||||
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user