Skip to content

Commit df91d36

Browse files
committed
ext/ldap: fix leak on port overflow check.
1 parent c978111 commit df91d36

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ext/ldap/ldap.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -984,8 +984,6 @@ PHP_FUNCTION(ldap_connect)
984984
RETURN_FALSE;
985985
}
986986

987-
object_init_ex(return_value, ldap_link_ce);
988-
ld = Z_LDAP_LINK_P(return_value);
989987

990988
{
991989
int rc = LDAP_SUCCESS;
@@ -1008,13 +1006,14 @@ PHP_FUNCTION(ldap_connect)
10081006

10091007
/* ensure all pending TLS options are applied in a new context */
10101008
if (ldap_set_option(NULL, LDAP_OPT_X_TLS_NEWCTX, &val) != LDAP_OPT_SUCCESS) {
1011-
zval_ptr_dtor(return_value);
10121009
php_error_docref(NULL, E_WARNING, "Could not create new security context");
10131010
RETURN_FALSE;
10141011
}
10151012
LDAPG(tls_newctx) = false;
10161013
}
10171014
#endif
1015+
object_init_ex(return_value, ldap_link_ce);
1016+
ld = Z_LDAP_LINK_P(return_value);
10181017

10191018
#ifdef LDAP_API_FEATURE_X_OPENLDAP
10201019
/* ldap_init() is deprecated, use ldap_initialize() instead.

0 commit comments

Comments
 (0)