Skip to content

Commit 7283065

Browse files
committed
Modify zend_collect_module_handlers to handle existing allocations
1 parent 48a8974 commit 7283065

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

Zend/zend_API.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,8 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
22712271
post_deactivate_count++;
22722272
}
22732273
} ZEND_HASH_FOREACH_END();
2274-
module_request_startup_handlers = (zend_module_entry**)malloc(
2274+
module_request_startup_handlers = (zend_module_entry**)realloc(
2275+
module_request_startup_handlers,
22752276
sizeof(zend_module_entry*) *
22762277
(startup_count + 1 +
22772278
shutdown_count + 1 +
@@ -2303,7 +2304,8 @@ ZEND_API void zend_collect_module_handlers(void) /* {{{ */
23032304
}
23042305
} ZEND_HASH_FOREACH_END();
23052306

2306-
class_cleanup_handlers = (zend_class_entry**)malloc(
2307+
class_cleanup_handlers = (zend_class_entry**)realloc(
2308+
class_cleanup_handlers,
23072309
sizeof(zend_class_entry*) *
23082310
(class_count + 1));
23092311
class_cleanup_handlers[class_count] = NULL;
@@ -2326,15 +2328,10 @@ ZEND_API void zend_startup_modules(void) /* {{{ */
23262328
}
23272329
/* }}} */
23282330

2329-
ZEND_API void zend_destroy_module_handlers(void)
2331+
ZEND_API void zend_destroy_modules(void) /* {{{ */
23302332
{
23312333
free(class_cleanup_handlers);
23322334
free(module_request_startup_handlers);
2333-
}
2334-
2335-
ZEND_API void zend_destroy_modules(void) /* {{{ */
2336-
{
2337-
zend_destroy_module_handlers();
23382335
zend_hash_graceful_reverse_destroy(&module_registry);
23392336
}
23402337
/* }}} */

Zend/zend_API.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module);
361361
ZEND_API zend_result zend_startup_module_ex(zend_module_entry *module);
362362
ZEND_API void zend_startup_modules(void);
363363
ZEND_API void zend_collect_module_handlers(void);
364-
ZEND_API void zend_destroy_module_handlers(void);
365364
ZEND_API void zend_destroy_modules(void);
366365
ZEND_API void zend_check_magic_method_implementation(
367366
const zend_class_entry *ce, const zend_function *fptr, zend_string *lcname, int error_type);

0 commit comments

Comments
 (0)