@@ -2504,19 +2504,19 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
25042504 dl_loaded_count ++ ;
25052505 }
25062506 } ZEND_HASH_FOREACH_END ();
2507- module_request_startup_handlers = (zend_module_entry * * )realloc (
2507+ module_request_startup_handlers = (zend_module_entry * * )perealloc (
25082508 module_request_startup_handlers ,
25092509 sizeof (zend_module_entry * ) *
25102510 (startup_count + 1 +
25112511 shutdown_count + 1 +
2512- post_deactivate_count + 1 ));
2512+ post_deactivate_count + 1 ), true );
25132513 module_request_startup_handlers [startup_count ] = NULL ;
25142514 module_request_shutdown_handlers = module_request_startup_handlers + startup_count + 1 ;
25152515 module_request_shutdown_handlers [shutdown_count ] = NULL ;
25162516 module_post_deactivate_handlers = module_request_shutdown_handlers + shutdown_count + 1 ;
25172517 module_post_deactivate_handlers [post_deactivate_count ] = NULL ;
25182518 /* Cannot reuse module_request_startup_handlers because it is freed in zend_destroy_modules, which happens before zend_unload_modules. */
2519- modules_dl_loaded = realloc (modules_dl_loaded , sizeof (zend_module_entry * ) * (dl_loaded_count + 1 ));
2519+ modules_dl_loaded = perealloc (modules_dl_loaded , sizeof (zend_module_entry * ) * (dl_loaded_count + 1 ), true );
25202520 modules_dl_loaded [dl_loaded_count ] = NULL ;
25212521 startup_count = 0 ;
25222522
@@ -2543,10 +2543,10 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
25432543 }
25442544 } ZEND_HASH_FOREACH_END ();
25452545
2546- class_cleanup_handlers = (zend_class_entry * * )realloc (
2546+ class_cleanup_handlers = (zend_class_entry * * )perealloc (
25472547 class_cleanup_handlers ,
25482548 sizeof (zend_class_entry * ) *
2549- (class_count + 1 ));
2549+ (class_count + 1 ), true );
25502550 class_cleanup_handlers [class_count ] = NULL ;
25512551
25522552 if (class_count ) {
@@ -3143,7 +3143,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
31433143 }
31443144 lowercase_name = zend_string_tolower_ex (internal_function -> function_name , type == MODULE_PERSISTENT );
31453145 lowercase_name = zend_new_interned_string (lowercase_name );
3146- reg_function = malloc (sizeof (zend_internal_function ));
3146+ reg_function = pemalloc (sizeof (zend_internal_function ), true );
31473147 memcpy (reg_function , & function , sizeof (zend_internal_function ));
31483148 if (zend_hash_add_ptr (target_function_table , lowercase_name , reg_function ) == NULL ) {
31493149 unload = 1 ;
@@ -3161,8 +3161,8 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
31613161 zend_flf_capacity *= 2 ;
31623162 }
31633163 /* +1 for NULL terminator */
3164- zend_flf_handlers = realloc (zend_flf_handlers , (zend_flf_capacity + 1 ) * sizeof (void * ));
3165- zend_flf_functions = realloc (zend_flf_functions , (zend_flf_capacity + 1 ) * sizeof (zend_function * ));
3164+ zend_flf_handlers = perealloc (zend_flf_handlers , (zend_flf_capacity + 1 ) * sizeof (void * ), true );
3165+ zend_flf_functions = perealloc (zend_flf_functions , (zend_flf_capacity + 1 ) * sizeof (zend_function * ), true );
31663166 }
31673167 zend_flf_handlers [zend_flf_count ] = flf_info -> handler ;
31683168 zend_flf_functions [zend_flf_count ] = (zend_function * )reg_function ;
@@ -3208,7 +3208,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
32083208
32093209 /* Treat return type as an extra argument */
32103210 num_args ++ ;
3211- new_arg_info = malloc (sizeof (zend_arg_info ) * num_args );
3211+ new_arg_info = pemalloc (sizeof (zend_arg_info ) * num_args , true );
32123212 reg_function -> arg_info = new_arg_info + 1 ;
32133213 for (i = 0 ; i < num_args ; i ++ ) {
32143214 zend_convert_internal_arg_info (& new_arg_info [i ], & arg_info [i ],
@@ -3493,7 +3493,7 @@ ZEND_API int zend_next_free_module(void) /* {{{ */
34933493
34943494static zend_class_entry * do_register_internal_class (const zend_class_entry * orig_class_entry , uint32_t ce_flags ) /* {{{ */
34953495{
3496- zend_class_entry * class_entry = malloc (sizeof (zend_class_entry ));
3496+ zend_class_entry * class_entry = pemalloc (sizeof (zend_class_entry ), true );
34973497 zend_string * lowercase_name ;
34983498 * class_entry = * orig_class_entry ;
34993499
0 commit comments