From: Ilia Alshanetsky Date: Wed, 18 Nov 2009 13:37:45 +0000 (+0000) Subject: Fixed bug #50212 (crash by ldap_get_option() with LDAP_OPT_NETWORK_TIMEOUT). X-Git-Tag: php-5.4.0alpha1~191^2~2381 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02fb2fc5b1176aa10f87f109f18b37e63752a816;p=php Fixed bug #50212 (crash by ldap_get_option() with LDAP_OPT_NETWORK_TIMEOUT). --- diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 00725dbc18..c1bfa87b06 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -1619,14 +1619,17 @@ PHP_FUNCTION(ldap_get_option) #ifdef LDAP_OPT_NETWORK_TIMEOUT case LDAP_OPT_NETWORK_TIMEOUT: { - struct timeval *timeout; + struct timeval *timeout = NULL; if (ldap_get_option(ld->link, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) { if (timeout) { ldap_memfree(timeout); } RETURN_FALSE; - } + } + if (!timeout) { + RETURN_FALSE; + } zval_dtor(retval); ZVAL_LONG(retval, timeout->tv_sec); ldap_memfree(timeout);