mirror of
https://github.com/php/php-src.git
synced 2024-11-26 11:23:47 +08:00
- Fix crash when zend_mm_shutdown is called more than once.
This commit is contained in:
parent
58ce28e588
commit
7f226a6b19
@ -451,8 +451,10 @@ ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC)
|
||||
zend_fast_cache_list_entry *fast_cache_list_entry, *next_fast_cache_list_entry;
|
||||
|
||||
#ifdef ZEND_MM
|
||||
zend_mm_shutdown(&AG(mm_heap));
|
||||
return;
|
||||
if (clean_cache) {
|
||||
zend_mm_shutdown(&AG(mm_heap));
|
||||
return;
|
||||
}
|
||||
#elif defined(ZEND_WIN32) && !ZEND_DEBUG
|
||||
if (clean_cache && AG(memory_heap)) {
|
||||
HeapDestroy(AG(memory_heap));
|
||||
|
@ -104,6 +104,7 @@ zend_bool zend_mm_add_memory_block(zend_mm_heap *heap, size_t block_size)
|
||||
if (!segment) {
|
||||
return 1;
|
||||
}
|
||||
/* fprintf(stderr, "Allocating segment %X\n", segment); */
|
||||
segment->next_segment = heap->segments_list;
|
||||
heap->segments_list = segment;
|
||||
|
||||
@ -147,8 +148,10 @@ void zend_mm_shutdown(zend_mm_heap *heap)
|
||||
while (segment) {
|
||||
prev = segment;
|
||||
segment = segment->next_segment;
|
||||
/* fprintf(stderr, "Freeing segment %X\n", prev);*/
|
||||
free(prev);
|
||||
}
|
||||
heap->segments_list = NULL;
|
||||
}
|
||||
|
||||
void *zend_mm_alloc(zend_mm_heap *heap, size_t size)
|
||||
|
Loading…
Reference in New Issue
Block a user