summaryrefslogtreecommitdiff
path: root/ext/ldap/ldap.c
diff options
context:
space:
mode:
authorStig Venaas <venaas@php.net>2001-06-20 21:12:55 +0000
committerStig Venaas <venaas@php.net>2001-06-20 21:12:55 +0000
commit399885cddb773aad2bcf2cbf6d5d9131711fd4f9 (patch)
treeb7a9fedbf0f600fdfa7cd957c6222782934bc4ae /ext/ldap/ldap.c
parentfce6f4c5cbae1a5283381c795d1f4c168b7e7b38 (diff)
downloadphp-git-399885cddb773aad2bcf2cbf6d5d9131711fd4f9.tar.gz
Fixed memory leak in ldap_get_entries() when using post RFC 1823 API.
Similar problems for other functions will be fixed
Diffstat (limited to 'ext/ldap/ldap.c')
-rw-r--r--ext/ldap/ldap.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 894031bd11..2b43fcd8e3 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -945,12 +945,22 @@ PHP_FUNCTION(ldap_get_entries)
add_index_string(tmp1, num_attrib, attribute, 1);
num_attrib++;
+#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
+ ldap_memfree(attribute);
+#endif
attribute = ldap_next_attribute(ldap, ldap_result_entry, ber);
}
+#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
+ if (ber != NULL)
+ ber_free(ber, 0);
+#endif
add_assoc_long(tmp1, "count", num_attrib);
dn = ldap_get_dn(ldap, ldap_result_entry);
add_assoc_string(tmp1, "dn", dn, 1);
+#if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
+ ldap_memfree(dn);
+#endif
zend_hash_index_update(return_value->value.ht, num_entries, (void *) &tmp1, sizeof(pval *), NULL);