summaryrefslogtreecommitdiff
path: root/ext/ldap
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-04-30 21:53:53 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-04-30 21:53:53 +0000
commit8a09151f5ee6f48011c22a7ea12e593a72c5f3f1 (patch)
treebd3cc106d515baf4c4d11ce8141349236bb52d86 /ext/ldap
parentc843ec8c6cd8f92ee4a4a2f7ce0e1bae4aaeb409 (diff)
downloadphp-git-8a09151f5ee6f48011c22a7ea12e593a72c5f3f1.tar.gz
emalloc -> safe_emalloc
Diffstat (limited to 'ext/ldap')
-rw-r--r--ext/ldap/ldap.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index f070cdba59..8529013cbf 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -564,7 +564,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
}
num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(attrs));
- if ((ldap_attrs = emalloc((num_attribs+1) * sizeof(char *))) == NULL) {
+ if ((ldap_attrs = safe_emalloc((num_attribs+1), sizeof(char *), 0)) == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not allocate memory");
RETURN_FALSE;
}
@@ -644,8 +644,8 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
ldap_filter = Z_STRVAL_PP(filter);
}
- lds = emalloc(nlinks * sizeof(ldap_linkdata));
- rcs = emalloc(nlinks * sizeof(*rcs));
+ lds = safe_emalloc(nlinks, sizeof(ldap_linkdata), 0);
+ rcs = safe_emalloc(nlinks, sizeof(*rcs), 0);
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(link));
for (i=0; i<nlinks; i++) {
@@ -1274,8 +1274,8 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
ldap_dn = Z_STRVAL_PP(dn);
num_attribs = zend_hash_num_elements(Z_ARRVAL_PP(entry));
- ldap_mods = emalloc((num_attribs+1) * sizeof(LDAPMod *));
- num_berval = emalloc(num_attribs * sizeof(int));
+ ldap_mods = safe_emalloc((num_attribs+1), sizeof(LDAPMod *), 0);
+ num_berval = safe_emalloc(num_attribs, sizeof(int), 0);
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(entry));
/* added by gerrit thomson to fix ldap_add using ldap_mod_add */
@@ -1311,7 +1311,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
}
num_berval[i] = num_values;
- ldap_mods[i]->mod_bvalues = emalloc((num_values + 1) * sizeof(struct berval *));
+ ldap_mods[i]->mod_bvalues = safe_emalloc((num_values + 1), sizeof(struct berval *), 0);
/* allow for arrays with one element, no allowance for arrays with none but probably not required, gerrit thomson. */
if ((num_values == 1) && (Z_TYPE_PP(value) != IS_ARRAY)) {
@@ -1703,7 +1703,7 @@ PHP_FUNCTION(ldap_set_option)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expected non-empty array value for this option");
RETURN_FALSE;
}
- ctrls = emalloc((1 + ncontrols) * sizeof(*ctrls));
+ ctrls = safe_emalloc((1 + ncontrols), sizeof(*ctrls), 0);
*ctrls = NULL;
ctrlp = ctrls;
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(newval));