ID: 48469
Updated by: [email protected]
Reported By: [email protected]
Status: Open
Bug Type: LDAP related
Operating System: linux
PHP Version: 5.*, 6CVS (2009-06-04)
-Assigned To:
+Assigned To: patrickallaert
New Comment:
The patch below corrects this problem.
Ok to commit this in HEAD followed by branches with MFH?
Index: ext/ldap/ldap.c
===================================================================
RCS file: /repository/php-src/ext/ldap/ldap.c,v
retrieving revision 1.161.2.3.2.11.2.25
diff -u -r1.161.2.3.2.11.2.25 ldap.c
--- ext/ldap/ldap.c 21 Apr 2009 18:08:34 -0000
1.161.2.3.2.11.2.25
+++ ext/ldap/ldap.c 4 Jun 2009 08:53:25 -0000
@@ -961,9 +961,6 @@
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 +971,9 @@
RETURN_FALSE;
}
+ array_init(return_value);
+ add_assoc_long(return_value, "count", num_entries);
+
while (ldap_result_entry != NULL) {
MAKE_STD_ZVAL(tmp1);
Previous Comments:
------------------------------------------------------------------------
[2009-06-04 08:51:44] [email protected]
Description:
------------
Memory leaks found when using ldap_get_entries() which returns NULL
Reproduce code:
---------------
<?php
ldap_get_entries(
$link,
ldap_search(
$link,
"dc=my-domain,dc=com",
"(o=unexisting-domain)"
)
);
?>
Actual result:
--------------
[Thu Jun 4 10:36:15 2009] Script: '/usr/src/php-5.3-
cvs/ext/ldap/tests/ldap_get_entries_variation.php'
/usr/src/php-5.3-cvs/Zend/zend_hash.c(247) : Freeing 0x12D749F8 (41
bytes), script=/usr/src/php-5.3-
cvs/ext/ldap/tests/ldap_get_entries_variation.php
[Thu Jun 4 10:36:15 2009] Script: '/usr/src/php-5.3-
cvs/ext/ldap/tests/ldap_get_entries_variation.php'
/usr/src/php-5.3-cvs/ext/ldap/ldap.c(964) : Freeing 0x12D75B14 (44
bytes), script=/usr/src/php-5.3-
cvs/ext/ldap/tests/ldap_get_entries_variation.php
/usr/src/php-5.3-cvs/Zend/zend_API.c(936) : Actual location (location
was relayed)
Last leak repeated 1 time
[Thu Jun 4 10:36:15 2009] Script: '/usr/src/php-5.3-
cvs/ext/ldap/tests/ldap_get_entries_variation.php'
/usr/src/php-5.3-cvs/Zend/zend_API.c(1096) : Freeing 0x12D7699C (20
bytes), script=/usr/src/php-5.3-
cvs/ext/ldap/tests/ldap_get_entries_variation.php
=== Total 4 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48469&edit=1