From: Ilia Alshanetsky Date: Wed, 30 Oct 2002 18:12:34 +0000 (+0000) Subject: Fixed a memory leak on ldap_connect() failure. X-Git-Tag: php-4.3.0RC1~407 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=433261281241adc7b090f0cf945f887ecd3f4f80;p=php Fixed a memory leak on ldap_connect() failure. --- diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 7c38088a45..edff9b6ce0 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -387,6 +387,7 @@ PHP_FUNCTION(ldap_connect) rc = ldap_initialize(&ldap, host); if (rc != LDAP_SUCCESS) { + efree(ld); php_error(E_WARNING, "%s(): Could not create session handle: %s", get_active_function_name(TSRMLS_C), ldap_err2string(rc)); RETURN_FALSE; } @@ -398,11 +399,13 @@ PHP_FUNCTION(ldap_connect) #endif if ( ldap == NULL ) { + efree(ld); RETURN_FALSE; } else { #ifdef HAVE_ORALDAP if (ssl) { if (ldap_init_SSL(&ldap->ld_sb, wallet, walletpasswd, authmode)) { + efree(ld); php_error(E_WARNING, "%s(): SSL init failed", get_active_function_name(TSRMLS_C)); RETURN_FALSE; }