]> granicus.if.org Git - php/commitdiff
MFH
authorIlia Alshanetsky <iliaa@php.net>
Thu, 1 May 2003 21:08:47 +0000 (21:08 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 1 May 2003 21:08:47 +0000 (21:08 +0000)
ext/mbstring/mbstring.c
ext/mbstring/php_mbregex.c

index 3c0ba33b2b34c8bc678cf7bbb4c3c9c1a9be9576..445f1c7c510f10bd9cb477dfca9bae81b0325b33 100644 (file)
@@ -894,7 +894,7 @@ PHP_RINIT_FUNCTION(mbstring)
                list = (int*)php_mbstr_default_identify_list;
                n = php_mbstr_default_identify_list_size;
        }
-       entry = (int *)emalloc(n*sizeof(int));
+       entry = (int *)safe_emalloc(n, sizeof(int), 0);
        if (entry != NULL) {
                MBSTRG(current_detect_order_list) = entry;
                MBSTRG(current_detect_order_list_size) = n;
@@ -3038,7 +3038,7 @@ PHP_FUNCTION(mb_convert_variables)
                /* auto detect */
                from_encoding = mbfl_no_encoding_invalid;
                stack_max = PHP_MBSTR_STACK_BLOCK_SIZE;
-               stack = (pval ***)emalloc(stack_max*sizeof(pval **));
+               stack = (pval ***)safe_emalloc(stack_max, sizeof(pval **), 0);
                if (stack != NULL) {
                        stack_level = 0;
                        identd = mbfl_encoding_detector_new(elist, elistsz TSRMLS_CC);
@@ -3126,7 +3126,7 @@ detect_end:
        /* convert */
        if (convd != NULL) {
                stack_max = PHP_MBSTR_STACK_BLOCK_SIZE;
-               stack = (pval ***)emalloc(stack_max*sizeof(pval **));
+               stack = (pval ***)safe_emalloc(stack_max, sizeof(pval **), 0);
                if (stack != NULL) {
                        stack_level = 0;
                        n = 2;
@@ -3249,7 +3249,7 @@ php_mbstr_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
                zend_hash_internal_pointer_reset(target_hash);
                i = zend_hash_num_elements(target_hash);
                if (i > 0) {
-                       convmap = (int *)emalloc(i*sizeof(int));
+                       convmap = (int *)safe_emalloc(i, sizeof(int), 0);
                        if (convmap != NULL) {
                                mapelm = convmap;
                                mapsize = 0;
index 450fadf6f7342eda4fab18fd76d5305b0ebeca9a..63f84c52b2646452b7e2b0c13925798af45bec37 100644 (file)
@@ -145,7 +145,7 @@ php_mbregex_compile_pattern(mb_regex_t *pre, const char *pattern, int patlen, in
        if(zend_hash_find(&MBSTRG(ht_rc), (char *)pattern, patlen+1, (void **) &rc) == FAILURE ||
                        rc->options != options || rc->mbctype != mbctype) {
                memset(pre, 0, sizeof(*pre));
-               pre->fastmap = (char*)emalloc((1 << MBRE_BYTEWIDTH)*sizeof(char));
+               pre->fastmap = (char*)safe_emalloc((1 << MBRE_BYTEWIDTH), sizeof(char), 0);
                if (pre->fastmap) {
                        pre->options = options;
                        pre->mbctype = mbctype;