From 02fb2fc5b1176aa10f87f109f18b37e63752a816 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Wed, 18 Nov 2009 13:37:45 +0000 Subject: [PATCH] Fixed bug #50212 (crash by ldap_get_option() with LDAP_OPT_NETWORK_TIMEOUT). --- ext/ldap/ldap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); -- 2.50.1