summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2008-04-16 13:20:59 +0000
committerAntony Dovgal <tony2001@php.net>2008-04-16 13:20:59 +0000
commit00e406ec415282d03d4fec7cde3736e889afcfb7 (patch)
tree863026995a8c2817b610fb8d23e95ae50035a524
parentde560f3161495f2287a6673b61a074b798585720 (diff)
downloadphp-git-00e406ec415282d03d4fec7cde3736e889afcfb7.tar.gz
plug minor memleak
-rw-r--r--ext/ldap/ldap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 0835537183..64aa016d63 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -1425,6 +1425,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
for (i = 0; i < num_attribs; i++) {
ldap_mods[i] = emalloc(sizeof(LDAPMod));
ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES;
+ ldap_mods[i]->mod_type = NULL;
if (zend_hash_get_current_key(Z_ARRVAL_PP(entry), &attribute, &index, 0) == HASH_KEY_IS_STRING) {
ldap_mods[i]->mod_type = estrdup(attribute);
@@ -1432,7 +1433,11 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown attribute in the data");
/* Free allocated memory */
while (i >= 0) {
- efree(ldap_mods[i--]);
+ if (ldap_mods[i]->mod_type) {
+ efree(ldap_mods[i]->mod_type);
+ }
+ efree(ldap_mods[i]);
+ i--;
}
efree(num_berval);
efree(ldap_mods);