@@ -2522,19 +2522,19 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
25222522 dl_loaded_count ++ ;
25232523 }
25242524 } ZEND_HASH_FOREACH_END ();
2525- module_request_startup_handlers = (zend_module_entry * * )realloc (
2525+ module_request_startup_handlers = (zend_module_entry * * )perealloc (
25262526 module_request_startup_handlers ,
25272527 sizeof (zend_module_entry * ) *
25282528 (startup_count + 1 +
25292529 shutdown_count + 1 +
2530- post_deactivate_count + 1 ));
2530+ post_deactivate_count + 1 ), 1 );
25312531 module_request_startup_handlers [startup_count ] = NULL ;
25322532 module_request_shutdown_handlers = module_request_startup_handlers + startup_count + 1 ;
25332533 module_request_shutdown_handlers [shutdown_count ] = NULL ;
25342534 module_post_deactivate_handlers = module_request_shutdown_handlers + shutdown_count + 1 ;
25352535 module_post_deactivate_handlers [post_deactivate_count ] = NULL ;
25362536 /* Cannot reuse module_request_startup_handlers because it is freed in zend_destroy_modules, which happens before zend_unload_modules. */
2537- modules_dl_loaded = realloc (modules_dl_loaded , sizeof (zend_module_entry * ) * (dl_loaded_count + 1 ));
2537+ modules_dl_loaded = perealloc (modules_dl_loaded , sizeof (zend_module_entry * ) * (dl_loaded_count + 1 ), 1 );
25382538 modules_dl_loaded [dl_loaded_count ] = NULL ;
25392539 startup_count = 0 ;
25402540
@@ -2561,10 +2561,10 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
25612561 }
25622562 } ZEND_HASH_FOREACH_END ();
25632563
2564- class_cleanup_handlers = (zend_class_entry * * )realloc (
2564+ class_cleanup_handlers = (zend_class_entry * * )perealloc (
25652565 class_cleanup_handlers ,
25662566 sizeof (zend_class_entry * ) *
2567- (class_count + 1 ));
2567+ (class_count + 1 ), 1 );
25682568 class_cleanup_handlers [class_count ] = NULL ;
25692569
25702570 if (class_count ) {
@@ -3076,7 +3076,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
30763076 }
30773077 lowercase_name = zend_string_tolower_ex (internal_function -> function_name , type == MODULE_PERSISTENT );
30783078 lowercase_name = zend_new_interned_string (lowercase_name );
3079- reg_function = malloc (sizeof (zend_internal_function ));
3079+ reg_function = pemalloc (sizeof (zend_internal_function ), 1 );
30803080 memcpy (reg_function , & function , sizeof (zend_internal_function ));
30813081 if (zend_hash_add_ptr (target_function_table , lowercase_name , reg_function ) == NULL ) {
30823082 unload = 1 ;
@@ -3094,8 +3094,8 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
30943094 zend_flf_capacity *= 2 ;
30953095 }
30963096 /* +1 for NULL terminator */
3097- zend_flf_handlers = realloc (zend_flf_handlers , (zend_flf_capacity + 1 ) * sizeof (void * ));
3098- zend_flf_functions = realloc (zend_flf_functions , (zend_flf_capacity + 1 ) * sizeof (zend_function * ));
3097+ zend_flf_handlers = perealloc (zend_flf_handlers , (zend_flf_capacity + 1 ) * sizeof (void * ), 1 );
3098+ zend_flf_functions = perealloc (zend_flf_functions , (zend_flf_capacity + 1 ) * sizeof (zend_function * ), 1 );
30993099 }
31003100 zend_flf_handlers [zend_flf_count ] = flf_info -> handler ;
31013101 zend_flf_functions [zend_flf_count ] = (zend_function * )reg_function ;
@@ -3143,7 +3143,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
31433143
31443144 /* Treat return type as an extra argument */
31453145 num_args ++ ;
3146- new_arg_info = malloc (sizeof (zend_internal_arg_info ) * num_args );
3146+ new_arg_info = pemalloc (sizeof (zend_internal_arg_info ) * num_args , 1 );
31473147 memcpy (new_arg_info , arg_info , sizeof (zend_internal_arg_info ) * num_args );
31483148 reg_function -> arg_info = new_arg_info + 1 ;
31493149 for (i = 0 ; i < num_args ; i ++ ) {
@@ -3169,7 +3169,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
31693169 new_arg_info [i ].type .type_mask |= _ZEND_TYPE_NAME_BIT ;
31703170 } else {
31713171 /* Union type */
3172- zend_type_list * list = malloc (ZEND_TYPE_LIST_SIZE (num_types ));
3172+ zend_type_list * list = pemalloc (ZEND_TYPE_LIST_SIZE (num_types ), 1 );
31733173 list -> num_types = num_types ;
31743174 ZEND_TYPE_SET_LIST (new_arg_info [i ].type , list );
31753175 ZEND_TYPE_FULL_MASK (new_arg_info [i ].type ) |= _ZEND_TYPE_UNION_BIT ;
@@ -3480,7 +3480,7 @@ ZEND_API int zend_next_free_module(void) /* {{{ */
34803480
34813481static zend_class_entry * do_register_internal_class (zend_class_entry * orig_class_entry , uint32_t ce_flags ) /* {{{ */
34823482{
3483- zend_class_entry * class_entry = malloc (sizeof (zend_class_entry ));
3483+ zend_class_entry * class_entry = pemalloc (sizeof (zend_class_entry ), 1 );
34843484 zend_string * lowercase_name ;
34853485 * class_entry = * orig_class_entry ;
34863486
0 commit comments