From: Patrick Allaert Date: Sun, 7 Jun 2009 13:07:58 +0000 (+0000) Subject: MFH: Fixed bug #48469 (ldap_get_entries() memory leaks on empty search results) X-Git-Tag: php-5.3.0RC3~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10b559c28c1058fe729a705cc09acba4a2adc6c4;p=php MFH: Fixed bug #48469 (ldap_get_entries() memory leaks on empty search results) --- diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index bb2489c53b..f7f4c02e5f 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -19,6 +19,7 @@ | Jani Taskinen | | Stig Venaas | | Doug Goldstein | + | Patrick Allaert | | PHP 4.0 updates: Zeev Suraski | +----------------------------------------------------------------------+ */ @@ -961,9 +962,6 @@ PHP_FUNCTION(ldap_get_entries) ldap = ld->link; num_entries = ldap_count_entries(ldap, ldap_result); - array_init(return_value); - add_assoc_long(return_value, "count", num_entries); - if (num_entries == 0) { RETURN_NULL(); } @@ -974,6 +972,9 @@ PHP_FUNCTION(ldap_get_entries) RETURN_FALSE; } + array_init(return_value); + add_assoc_long(return_value, "count", num_entries); + while (ldap_result_entry != NULL) { MAKE_STD_ZVAL(tmp1);